You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running tsc should successfully compile the project into the dist directory.
Actual behavior:
A compile error is printed:
error TS2688: Cannot find type definition file for '@scope'.
Comments:
This is because it appears the compiler is only looking in the top-level directory (in this case, types/@scope) for a type definition and not the directory of the scoped package (types/@scope/scoped). A few projects in the DefinitelyTyped project have gotten around this limitation by employing some variations of the same technique[1][2][3].
Here's what I've seen as workarounds:
Publish an entire scope's module definitions under a single file @scope/* => scope (downloading more than necessary)
Publish a scoped module as un-scoped @scope/module => module (collisions possible?)
Use a special naming convention @scope/module => scope__module
In this project, the issue can be fixed if one just moves types/@scope/scoped to types/scoped.
Maybe this is something that just needs to be handled in conventions used by the folks in the DefinitelyTyped project (e.g. @scope/module => scope__module). But what this issue is proposing is a solution that is likely to be the expected experience when doing the above. This is maybe less of a bug and more of a developer ergonomics/UX issue.
I'd be perfectly cool closing this issue and just recommending documentation changes be made to call out this case and suggest the third bullet item above as a solution. This use case is especially useful for those of us individuals or companies with a semi-large catalog of scoped private packages and are making the migration to Typescript.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.2.2
Code
Expected behavior:
Running
tsc
should successfully compile the project into thedist
directory.Actual behavior:
A compile error is printed:
Comments:
This is because it appears the compiler is only looking in the top-level directory (in this case,
types/@scope
) for a type definition and not the directory of the scoped package (types/@scope/scoped
). A few projects in the DefinitelyTyped project have gotten around this limitation by employing some variations of the same technique[1][2][3].Here's what I've seen as workarounds:
@scope/* => scope
(downloading more than necessary)@scope/module => module
(collisions possible?)@scope/module => scope__module
In this project, the issue can be fixed if one just moves
types/@scope/scoped
totypes/scoped
.Maybe this is something that just needs to be handled in conventions used by the folks in the DefinitelyTyped project (e.g.
@scope/module
=>scope__module
). But what this issue is proposing is a solution that is likely to be the expected experience when doing the above. This is maybe less of a bug and more of a developer ergonomics/UX issue.I'd be perfectly cool closing this issue and just recommending documentation changes be made to call out this case and suggest the third bullet item above as a solution. This use case is especially useful for those of us individuals or companies with a semi-large catalog of scoped private packages and are making the migration to Typescript.
The text was updated successfully, but these errors were encountered: