TypeScript Version: nightly (2.1.0-dev.20160923)
node_modules/@types/a/index.d.tsexport declare class A {}
node_modules/@types/b/index.d.tsimport {A} from "a";
export declare class B extends A {}
tsconfig.json{
"compilerOptions": {
"module": "es2015"
}
}
src/foo.tsMay leave this empty.
node_modules/@types/b/index.d.ts can reference node_modules/@types/a/index.d.ts
node_modules/@types/b/index.d.ts(1,17): error TS2307: Cannot find module 'a'.
This may be fixed by adding "moduleResolution": "node" to tsconfig.json.
I am sure we had another issue for this, but can not seem to find it.
@andy-ms we should get a fix for this soon as well.
The quick fix doesn't solve the problem when developing AMD-based projects. All modules defined in the project are in AMD format. If moduleResolution is set to node then these modules can't be imported properly.
This will also enable scenario of using Rollup.js for bundling and npm link for linking components / solution projects
(rollup requires ES6 modules, and right now emitting ES6 modules breaks Node module resolution)
@cnshenj What is your workaround for now? We have the same problem with _momentjs_ and _knockout-decorators_
@ViceIce Just keep using typings to get all declaration files for AMD-based projects. Have to wait for TypeScript 2.1 to switch from typings to @types.
@cnshenj If you use relative path then it will work. That's the workaround for me.
Most helpful comment
The quick fix doesn't solve the problem when developing AMD-based projects. All modules defined in the project are in AMD format. If
moduleResolutionis set tonodethen these modules can't be imported properly.