TypeScript Version: 4.0.0-dev.20200528
Search Terms: javascript declaration js dot array notation namespace
Code
index.js:
exportconstcolors={royalBlue: "#6400e4",};exportconstbrandColors={purple: colors.royalBlue,};Expected behavior:
When compiled with tsc --allowJs --declaration --emitDeclarationOnly index.js, it should export:
exportnamespacecolors{exportconstroyalBlue: string;}exportnamespacebrandColors{importpurple=colors.royalBlue;export{purple};}Actual behavior:
Instead, we get:
exportnamespacecolors{exportconstroyalBlue: string;}exportnamespacebrandColors{importpurple=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...
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...