-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to get types for .coffee
files without adding .d.ts
files adjacent to them?
#12
Comments
I think all you need is to specify the file extension: { Observable } = require "./jadelet.coffee" Autocompletion should even suggest this to you as it scans the available file paths. Does this solve it for you? Not sure if missing extensions can be achieved, I remotely remember that only jsx,tsx,js and ts can be implicitly imported and everything else needs explicit file extensions, maybe I am wrong though. CoffeeSense could probably also fix this |
yeah custom file extensions are not allowed by typescript: microsoft/TypeScript#10939 but the extension should fix this imo. I'll fix it some other day so that your code also works nicely. |
Thanks for the fast response! Adding the extension works though I would like the flexibility of not needing to specify it. That way I could have |
This is now possible with version 1.9.0 (you need to check that VSCode updated the extension, it usually takes two reloads for that). Can you test this out and tell me if it now works as desired? |
@phil294 It works! |
First off, thank you for this extension! It is of great use to me overall.
In my simpler projects that have only one or two
.coffee
files I can easily access all the TypeScript types from imports and other shared locations. On my larger projects that have many.coffee
files, some of whichrequire
others, they lose the types after the first layer.Very basic example:
This file works, all the types are available because the
jadelet
package exports the types.Here is the problem...
The module
./jadelet
exists but TypeScript doesn't know about it. A work around is to createjadelet.d.ts
files by manually compiling.coffee
->.js
->.d.ts
but that seems excessive since all the data is "almost" there. Is it possible to tell TypeScript more directly that the types in these files exist?With the JSDoc support
.coffee
files can pretty much export fully annotated types (especially after importing from./typings/
etc.). Is there anything that can be done to lettsserver
know that non-ts
files could contain types?The text was updated successfully, but these errors were encountered: