-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Description
TypeScript Version: 2.8.3
Code
export interface IValidationError {
message: string;
}
export default class Operation {
validateParameters(parameterValues: any) : IValidationError[] | null {
let result: IValidationError[] | null = null;
for(const parameterLocation of Object.keys(parameterValues)) {
const parameter: any = (this as any).getParameter();;
const values = (this as any).getValues();
const innerResult = parameter.validate(values[parameter.oaParameter.name]);
if(innerResult && innerResult.length > 0) {
// Commenting out this line will fix the problem.
result = (result || []).concat(innerResult);
}
}
return result;
}
}```
tsconfig.json:
```json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": ["es6"],
"allowJs": false,
"declaration": true,
"declarationDir": "./types",
"sourceMap": true,
"outDir": "./lib",
"stripInternal": true,
"strict": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"typeRoots": [
"./node_modules/@types",
"./@types"
],
"esModuleInterop": true
},
"include": [
"./src/**/*"
],
"compileOnSave": true
}Expected behavior:
Compile this into JS.
Actual behavior:
RangeError: Maximum call stack size exceeded
at /Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:31413:53
at Object.findAncestor (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:343:26)
at isInsideFunction (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:31413:25)
at checkNestedBlockScopedBinding (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:31422:34)
at checkIdentifier (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:31349:13)
at checkExpressionWorker (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:35793:28)
at checkExpression (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:35769:42)
at checkExpressionCached (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:35672:38)
at getTypeOfExpression (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:35754:28)
at getContextualTypeForBinaryOperand (/Users/jwalton/.nvm/versions/node/v8.11.1/lib/node_modules/typescript/lib/tsc.js:31916:25)
This passes in playground.
Related Issues:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript