]> git.wincent.com - wincent.git/commitdiff
refactor: show that imports aren't working well
authorGreg Hurrell <greg@hurrell.net>
Wed, 18 Mar 2020 20:14:57 +0000 (21:14 +0100)
committerGreg Hurrell <greg@hurrell.net>
Fri, 20 Mar 2020 09:53:24 +0000 (10:53 +0100)
Sadly, we can't do imports without TS screaming bloody murder in Vim:

    An import path cannot end with a '.d.ts' extension

etc

Related:

    https://github.com/Microsoft/TypeScript/issues/27481

We can suppress the error, but either way, the editor can't see the
types, sadly obviating one of the big upsides of using TypeScript.

lib/main.ts
lib/other.ts [new file with mode: 0644]
tsconfig.json

index c2aebde15bdce4829db55efdb5cefb2ceb90467a..4890837d82a6b70223bae7d44ee0e39ae593ac48 100644 (file)
@@ -1,4 +1,8 @@
 // This is only for the benefit of the LanguageClient.
+// @ts-ignore
 import type Deno from '../vendor/deno/types.d.ts';
 
-console.log(Deno.args);
+// @ts-ignore
+import test from './other.ts';
+
+test(Deno.args);
diff --git a/lib/other.ts b/lib/other.ts
new file mode 100644 (file)
index 0000000..247226c
--- /dev/null
@@ -0,0 +1,3 @@
+export default function(args: Array<string>) {
+  console.log(...args);
+}
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e1529ad3cc9fd2e643e7ced3cb25ac9573b1f52a 100644 (file)
@@ -0,0 +1,3 @@
+{
+  "include": ["src/**/*.ts", "vendor/deno/types.d.ts"]
+}