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

Publish .d.ts type declaration in npm package instead of source .ts #638

Closed
aidenlx opened this issue Mar 23, 2022 · 4 comments
Closed

Publish .d.ts type declaration in npm package instead of source .ts #638

aidenlx opened this issue Mar 23, 2022 · 4 comments
Labels
bug Something isn't working types

Comments

@aidenlx
Copy link
Contributor

aidenlx commented Mar 23, 2022

I've encountered some typescript check problem when I'm using strict mode in tsconfig. It seems that tsc is reporting strict check errors on .ts files published in npm package such as noImplicitAny. I initially though it's a configuration problem around skipLibCheck but eventually I found this issue which suggests that publish .ts file directly is not good in practice, and skipLibCheck explicitly escape .ts files inside libs for that reason.

@mihar-22
Copy link
Member

mihar-22 commented Mar 24, 2022

I see I thought resolved this but it might be because one of the type declaration files is still inside the src folder. Specfically dom.d.ts. I've moved it out and I'll test if it resolves it.

It'd be awesome if you could try manually moving dom.d.ts in your node_modules/@vidstack/foundation folder from src to package root, updating the sibling globals.d.ts file to point to it, and letting me know if it fixes your issues.

@mihar-22 mihar-22 added bug Something isn't working types labels Mar 24, 2022
@aidenlx
Copy link
Contributor Author

aidenlx commented Mar 24, 2022

maybe you can try use this to let tsc generate type declaration only and only include .d.ts in src dir when publishing package:

{
  "compilerOptions": {
    "emitDeclarationOnly": true,
    "declarationDir": "SOME_TYPE_DIR"
  }
}

@mihar-22
Copy link
Member

mihar-22 commented Mar 24, 2022

That's exactly what we're doing right now. Emitted to types/ folder. The src folder is so sourcemaps work when debugging.

@mihar-22
Copy link
Member

mihar-22 commented Apr 4, 2022

Types should be all fixed in latest 1.4.0!

@mihar-22 mihar-22 closed this as completed Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working types
Projects
None yet
Development

No branches or pull requests

2 participants