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

d.ts imports contain invalid and redundant file extensions #222

Closed
2 tasks done
ErkoKnoll opened this issue Jul 2, 2021 · 1 comment
Closed
2 tasks done

d.ts imports contain invalid and redundant file extensions #222

ErkoKnoll opened this issue Jul 2, 2021 · 1 comment

Comments

@ErkoKnoll
Copy link

Describe the bug

d.ts imports contain file extensions that are redundant and invalid, which makes loading type definitions in some systems work incorrectly.

For example: https://unpkg.com/browse/[email protected]/dist/types/jwt/sign.d.ts type definition has 2 following imports:

import type { JWSHeaderParameters, JWTPayload, KeyLike, SignOptions } from '../types.d';
import ProduceJWT from '../lib/jwt_producer.js';

When specified like this, with an extension, some systems may try to find these imports explicitly with these extensions, but files with such extensions don't exist in relative to the path. However there are files with jwt_producer.d.ts and types.d.ts.

It probably is better to simply remove these extensions as then it should still continue to work, whereas most systems will then try to find imports with several extensions, including .d.ts for type definitions, .ts for sources and .js for transpiled JS files. Change probably should be done at the source level, as the imports in type definitions are reflections of the source, and the source is written in TS, but uses explicit .js or .d import extensions.

To Reproduce

This issue is present in AutoBlocks online editor (Monaco based). While we monkey patched it currently to work more or less correctly, then there are still some weird issues where types are not being loaded correctly by Monaco editor. I can provide additional steps to try it out in AutoBlocks environment if needed.

  • the bug is happening on latest jose too.
  • i have searched the issues tracker on github for similar issues and couldn't find anything related.
@panva
Copy link
Owner

panva commented Jul 2, 2021

Thanks @ErkoKnoll I'll be publishing a release shortly where all .d.ts files in the types folder contain no file extensions.

@panva panva removed the triage label Jul 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants