Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

TypeError with promise-function-async #2052

Closed
RomkeVdMeulen opened this issue Jan 16, 2017 · 3 comments
Closed

TypeError with promise-function-async #2052

RomkeVdMeulen opened this issue Jan 16, 2017 · 3 comments

Comments

@RomkeVdMeulen
Copy link
Contributor

Bug Report

  • TSLint version: 4.3.1
  • TypeScript version: 2.1.5
  • Running TSLint via: Node.js API

TypeScript code being linted

export class User {

	id: number;
	email: string;
	permissions: string[];

	constructor(copy?: Object) {
		if (copy) {
			Object.assign(this, copy);
		}
	}

	hasPermission(permission: string) {
		return this.permissions.includes(permission);
	}
}

Actual behavior

TypeError: Cannot read property 'flags' of undefined
    at getTypeOfSymbol (node_modules/typescript/lib/typescript.js:27568:23)
    at Object.getTypeOfNode [as getTypeAtLocation] (node_modules/typescript/lib/typescript.js:42325:24)
    at PromiseAsyncWalker.handleDeclaration (node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js:73:28)
    at PromiseAsyncWalker.visitMethodDeclaration (node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js:68:14)
    at PromiseAsyncWalker.SyntaxWalker.visitNode (node_modules/tslint/lib/language/walker/syntaxWalker.js:409:22)
    at node_modules/tslint/lib/language/walker/syntaxWalker.js:517:63
    at visitEachNode (node_modules/typescript/lib/typescript.js:13882:30)
    at Object.forEachChild (node_modules/typescript/lib/typescript.js:14125:21)
    at PromiseAsyncWalker.SyntaxWalker.walkChildren (node_modules/tslint/lib/language/walker/syntaxWalker.js:517:12)
    at PromiseAsyncWalker.SyntaxWalker.visitClassDeclaration (node_modules/tslint/lib/language/walker/syntaxWalker.js:62:14)
    at PromiseAsyncWalker.SyntaxWalker.visitNode (node_modules/tslint/lib/language/walker/syntaxWalker.js:304:22)
    at node_modules/tslint/lib/language/walker/syntaxWalker.js:517:63
    at visitEachNode (node_modules/typescript/lib/typescript.js:13882:30)
    at Object.forEachChild (node_modules/typescript/lib/typescript.js:14053:24)
    at PromiseAsyncWalker.SyntaxWalker.walkChildren (node_modules/tslint/lib/language/walker/syntaxWalker.js:517:12)
    at PromiseAsyncWalker.SyntaxWalker.visitSourceFile (node_modules/tslint/lib/language/walker/syntaxWalker.js:218:14)
    at PromiseAsyncWalker.SyntaxWalker.visitNode (node_modules/tslint/lib/language/walker/syntaxWalker.js:463:22)
    at PromiseAsyncWalker.SyntaxWalker.walk (node_modules/tslint/lib/language/walker/syntaxWalker.js:23:14)
    at Rule.AbstractRule.applyWithWalker (node_modules/tslint/lib/language/rule/abstractRule.js:46:16)
    at Rule.applyWithProgram (node_modules/tslint/lib/rules/promiseFunctionAsyncRule.js:31:21)
    at Linter.applyRule (node_modules/tslint/lib/linter.js:140:33)
    at Linter.lint (node_modules/tslint/lib/linter.js:109:41)

Expected behavior

No crash

@RomkeVdMeulen
Copy link
Contributor Author

Looks like a duplicate of #1641 or #1606 but I'm not using the "no-unused-variable" rule so the suggested workaround won't work for me.

@andy-hanson
Copy link
Contributor

I can't reproduce this. Globally installed tslint@4.3.1 and typescript@2.1.5. What tsconfig.json do you have?

@RomkeVdMeulen
Copy link
Contributor Author

Haven't seen this recur for months, not sure what ever happened to the problem. I'll just close this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants