Description
TypeScript Version: 3.1.0-dev.20180809, 3.0.1
Search Terms:
Cannot read property 'charCodeAt' of undefined
Code
interface Limit1 {
propName: { min: number; max: number };
}
interface Limit2 {
propName: { min: number; max: number };
}
type Limit = Limit1 | Limit2; // should be Union type
export interface Meta {
propName: "propName";
}
function foo (meta: Meta, limits: Limit): void {
const {
[`propName`]: { min: minBonus, max: maxBonus }, // should be computed
} = limits;
}
Expected behavior:
No crash, code compiled
Actual behavior:
Cannot read property 'charCodeAt' of undefined
.../node_modules/typescript/lib/tsc.js:68035 throw e; ^TypeError: Cannot read property 'charCodeAt' of undefined
at isLateBoundName (.../node_modules/typescript/lib/tsc.js:28756:25)
at createUnionOrIntersectionProperty (.../node_modules/typescript/lib/tsc.js:29638:38)
at getUnionOrIntersectionProperty (.../node_modules/typescript/lib/tsc.js:29699:28)
at getPropertyOfUnionOrIntersectionType (.../node_modules/typescript/lib/tsc.js:29707:28)
at getPropertyOfType (.../node_modules/typescript/lib/tsc.js:29727:24)
at checkVariableLikeDeclaration (.../node_modules/typescript/lib/tsc.js:43025:36)
at checkBindingElement (.../node_modules/typescript/lib/tsc.js:43123:20)
at checkSourceElement (.../node_modules/typescript/lib/tsc.js:44827:28)
at Object.forEach (.../node_modules/typescript/lib/tsc.js:168:30)
at checkVariableLikeDeclaration (.../node_modules/typescript/lib/tsc.js:43036:20)
Note, that the code is not compiled