Skip to content
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

Typescript requiring definitions #115

Closed
Rioos opened this issue Mar 31, 2019 · 6 comments
Closed

Typescript requiring definitions #115

Rioos opened this issue Mar 31, 2019 · 6 comments

Comments

@Rioos
Copy link

Rioos commented Mar 31, 2019

Not sure how the whole TS env works but I'm importing demofile as

import {DemoFile} from 'demofile'

And it sends me a message saying that I should create a d.ts file for this.

Can't understand why this is happening, isn't the lib fully written in TS? Why is it asking me a definition tho?

Thanks sir

@saul
Copy link
Owner

saul commented Apr 2, 2019

You're right in thinking that the entire library is written in TypeScript, it's just that at the moment the library doesn't produce a .d.ts! I'll see if I can add this - from my preliminary testing it doesn't look like the simplest change.

@naftis
Copy link

naftis commented Apr 8, 2019

@saul, I can also look into this. We need to add declaration: true to tsconfig.json, but it doesn't allow .js files to be compiled at the same time. But I think there must be a workaround as the .d.ts's are provided for the JS files.

I started to implement the changes yesterday, but there was some problems with the project's TS compilation which needs to be looked into. I'm sure you might have already ran into this stuff.

@Rioos
Copy link
Author

Rioos commented Apr 8, 2019

Hmmm, interesting! We might want to fully write in typescript then using declaration: true. Might be the easiest way to achieve that.

@naftis
Copy link

naftis commented Jun 12, 2019

microsoft/TypeScript#31639
TS 3.6 (release on August 13th) should allow declaration with allowJs, and then we're able to use the existing declaration files for the JS files. Alternative solution is rewriting fully with TS.

@jason-yang
Copy link

You can compile in 2 steps, 1 with addJs: true one with declarations: true (or use the cli options). You're also going to hit the very annoying problem of typescript only accepting subfolders as modules if it's in the root directory of the package... Good luck

@saul
Copy link
Owner

saul commented Nov 6, 2019

Released v1.1.0 with this

@saul saul closed this as completed Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants