Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[promise-function-async] problem with exported functions #227

Closed
Assignees
armano2
Labels
bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@berlysia

Description

@berlysia

Repro

{"rules": {"@typescript-eslint/promise-function-async": ["error",      {"allowedPromiseNames": [],"checkArrowFunctions":false,"checkFunctionDeclarations":true,"checkFunctionExpressions":false,"checkMethodDeclarations":false      }    ]  }}

code 1:

exportfunctionvalid(n:number){returnn;}

code 2

exportdefaultfunctioninvalid(n:number){returnn;}

Expected Result
code 1 - no error
code 2 - lint error

Actual Result

TypeError: Cannot read property 'resolvedReturnType' of undefined    at Object.getReturnTypeOfSignature (/path/to/repo/node_modules/typescript/lib/typescript.js:38106:28)    at validateNode (/path/to/repo/node_modules/@typescript-eslint/eslint-plugin/lib/rules/promise-function-async.js:91:34)    at FunctionDeclaration (/path/to/repo/node_modules/@typescript-eslint/eslint-plugin/lib/rules/promise-function-async.js:111:11)    at listeners.(anonymous function).forEach.listener (/path/to/repo/node_modules/eslint/lib/util/safe-emitter.js:45:58)    at Array.forEach (<anonymous>)    at Object.emit (/path/to/repo/node_modules/eslint/lib/util/safe-emitter.js:45:38)    at NodeEventGenerator.applySelector (/path/to/repo/node_modules/eslint/lib/util/node-event-generator.js:251:26)    at NodeEventGenerator.applySelectors (/path/to/repo/node_modules/eslint/lib/util/node-event-generator.js:280:22)    at NodeEventGenerator.enterNode (/path/to/repo/node_modules/eslint/lib/util/node-event-generator.js:294:14)    at CodePathAnalyzer.enterNode (/path/to/repo/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:632:23)

Additional Info

No problem with non-exported function declarations:

functionvalid(n:number){returnn;}functioninvalid(p:Promise<void>){returnp;}// lint error

and also with arrow functions (checkArrowFunctions: true ):

exportconstvalid=(n:number)=>n;exportconstinvalid=(p:Promise<void>)=>p;// lint error

Versions

packageversion
@typescript-eslint/eslint-plugin1.2.0
@typescript-eslint/parser1.2.0
TypeScript3.2.4,3.3.0
ESLint5.13.0
node11.8.0
npm6.7.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp