-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: v1.8.10
-
Create a basic external npm package 'node_modules/ext'. In it, set up the following 2 files:
// ext.d.ts declare var _default: {}; export default _default; // package.json (edit it) "main": "ext", "typings": "ext",
-
Reference package 'ext' from A.ts, using
--declaration
, generating A.d.ts// A.ts import ext from 'ext'; declare module 'ext' { }
-
Copy A.d.ts to another directory, that has the ext package installed in node_modules
// B.ts import * as modA from './A'
Expected behavior:
Generated A.d.ts causes no errors because typed package 'ext' was in the correct location.
Actual behavior:
A.d.ts(1,16): error TS2664: Invalid module name in augmentation, module 'ext' cannot be found.
Workarounds:
- explicitly import 'ext' module while in B
- re-export something from B as part of A (triggering an import to be generated in A.d.ts)
Remarks:
This is frustrating because the fact that A depended on 'ext' was an implementation detail, and in reality npm
was the one that brought 'ext' into node_modules.
Thoughts?
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript