-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Description
Bug Report
I have declared a global namespace in a typings.d.ts file like this:
declare namespace NAMESPACE {
export enum Colours {
GREEN = 'GREEN',
AMBER = 'AMBER',
RED = 'RED',
}
export type User = {
name: string;
}
}
My tsconfig looks like this:
{
"compilerOptions": {
"target": "esnext",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src",
"./global.d.ts",
"./typings.d.ts"
]
}
When I'm trying to access the enum I defined in my namespace, I'm getting a runtime error saying: Typescript ReferenceError: NAMESCAPE is not defined. This applies just to enums as everything is alright with the types I'm exporting via the same namespace.
Ex.
if (colour === NAMESPACE.Colours.GREEN)) {...} // Typescript ReferenceError: NAMESCAPE is not defined
🕗 Version & Regression Information
I had this bug in version 3.9.2, updated to 4.1.3 and it is still there.
🙁 Actual behavior
When I'm trying to access the enum I defined in my namespace, I'm getting a runtime error saying: Typescript ReferenceError: NAMESCAPE is not defined.
🙂 Expected behavior
Should be able to access an enum via a namespace.
Metadata
Metadata
Assignees
Labels
No labels