Code
node_modules/@types/thirdParty/index.d.ts
export = demo;
declare namespace demo {
foo: number;
}
main.js
// @ts-check
/// <reference types="thirdParty" />
const x: demo.foo;
Expected behavior:
I should be able to use the type foo of demo.
The example from above would work if but only if the thirdParty plugin also exports its namespace:
export as namespace demo;
I couldn't find any docs on what exactly export as namespace does.
Proably it would just add it to the global namespace which might not be the desired solution.
Actual behavior:
Without the exported namespace I receive error messages which are not helpful at all:
error TS2304: Cannot find name 'demo'
error TS2503: Cannot find namespace 'demo'
Suggestion:
Could we import everything which is exported from the index.d.ts file (like export = demo) to a name?
This would be useful for --allowJs checks where we can't import typings from another file.
// @ts-check
/// <reference types="thirdParty" name="thirdParty" />
Code
node_modules/@types/thirdParty/index.d.tsmain.jsExpected behavior:
I should be able to use the type
fooofdemo.The example from above would work if but only if the thirdParty plugin also exports its namespace:
I couldn't find any docs on what exactly
export as namespacedoes.Proably it would just add it to the global namespace which might not be the desired solution.
Actual behavior:
Without the exported namespace I receive error messages which are not helpful at all:
Suggestion:
Could we import everything which is exported from the index.d.ts file (like
export = demo) to a name?This would be useful for
--allowJschecks where we can't import typings from another file.