2

Is there any way to require imports to include the .ts extension, or at least allow it? My typescript linter currently spits out this error: An import path cannot end with a '.ts' extension. Consider importing './math' instead, but deno requires the file extension to be present.

Kris10an
  • 548
  • 3
  • 23
  • Does [this](https://stackoverflow.com/a/63289023/12769288) answer your question? Also, what editor are you using? in VSCode you can enable Deno support for a project and that will get rid of these error messages. – Zwiers Jun 14 '21 at 20:30
  • @Zwiers I saw that answer, but the idea of just //@ts-ignore -ing errors isn't really that satisfying of an answer. I will just install the deno extension, but it would be nice to just be able to do it via the tsconfig.json file if possible – Kris10an Jun 14 '21 at 21:58
  • If you use VSCode then [this](https://stackoverflow.com/questions/65115527/how-can-i-avoid-the-an-import-path-cannot-end-with-ts-extension-error-in-vsco) might help as well. – jps Jun 14 '21 at 21:58

1 Answers1

4

If you're using VS Code, install the official Deno extension and initialize it in your workspace by hitting ctrl + p and searching for the "initialize workspace" command. Be sure to set deno.lint: true

If you're linting from the command line, just use deno lint directly.

The official tsc will always complain about import specifiers having the .ts extension in it. There's a few issue on the TypeScript repo to enable this feature, none of which have shown any sign of being merged at the time of writing this answer.

William Perron
  • 1,288
  • 13
  • 18