stimulus-lsp icon indicating copy to clipboard operation
stimulus-lsp copied to clipboard

Suggestion to register import has .ts extension

Open SleeplessByte opened this issue 1 year ago • 3 comments

When following the suggestion to import a controller:

Quick fix for a stimulus controller

The import is always added with the .ts extension (the file is .ts). However, this only works if the current tsconfig.json setting allowImportingTsExtensions. If this is set to false (default), the import fails.

An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. ts(5097)

SleeplessByte avatar May 15 '24 14:05 SleeplessByte

Thanks for reporting @SleeplessByte! That's an interesting one. I guess ideally we could just never include the file extension. That should work for both JavaScript and TypeScript in most cases.

marcoroth avatar May 15 '24 23:05 marcoroth

I dont know if there are cases where the extension is required. There probably are but i would wait for the bug report to support it 😄

SleeplessByte avatar May 16 '24 07:05 SleeplessByte

I don't think I added the extension on purpose, it was more a side effect while dealing with files/paths.

marcoroth avatar May 16 '24 10:05 marcoroth