TypeScript Version: 4.0.0-dev.20200528
Search Terms: javascript declaration js dot array notation namespace
Code
index.js:
export const colors = {
royalBlue : "#6400e4" ,
} ;
export const brandColors = {
purple : colors . royalBlue ,
} ;
Expected behavior:
When compiled with tsc --allowJs --declaration --emitDeclarationOnly index.js, it should export:
export namespace colors {
export const royalBlue : string ;
}
export namespace brandColors {
import purple = colors . royalBlue ;
export { purple } ;
}
Actual behavior:
Instead, we get:
export namespace colors {
export const royalBlue : string ;
}
export namespace brandColors {
import purple = royalBlue ;
export { purple } ;
}
Note the import purple = royalBlue;. It's missing colors..
Compiler Options
{
"compilerOptions" : {
"noImplicitAny" : true ,
"strictFunctionTypes" : true ,
"strictPropertyInitialization" : true ,
"strictBindCallApply" : true ,
"noImplicitThis" : true ,
"noImplicitReturns" : true ,
"alwaysStrict" : true ,
"esModuleInterop" : true ,
"checkJs" : true ,
"allowJs" : true ,
"declaration" : true ,
"experimentalDecorators" : true ,
"emitDecoratorMetadata" : true ,
"moduleResolution" : 2 ,
"target" : " ES2017" ,
"jsx" : " React" ,
"module" : " ESNext"
}
}
Playground Link: Provided
Related Issues: The closest issues I could find were #36270 and #33626 ...
Reactions are currently unavailable
TypeScript Version: 4.0.0-dev.20200528
Search Terms: javascript declaration js dot array notation namespace
Code
index.js:Expected behavior:
When compiled with
tsc --allowJs --declaration --emitDeclarationOnly index.js, it should export:Actual behavior:
Instead, we get:
Note the
import purple = royalBlue;. It's missingcolors..Compiler Options
{ "compilerOptions": { "noImplicitAny": true, "strictFunctionTypes": true, "strictPropertyInitialization": true, "strictBindCallApply": true, "noImplicitThis": true, "noImplicitReturns": true, "alwaysStrict": true, "esModuleInterop": true, "checkJs": true, "allowJs": true, "declaration": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "moduleResolution": 2, "target": "ES2017", "jsx": "React", "module": "ESNext" } }Playground Link: Provided
Related Issues: The closest issues I could find were #36270 and #33626...