-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Domain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do thischeckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript
Milestone
Description
TypeScript Version: 3.8.2
Search Terms: allowJs declaration 'async' modifier cannot be used in an ambient context.ts
Code
see code
when run tsc with allowJs and declaration flags enabled the code below
export class TestJS {
callAsync() {
return Promise.resolve(1);
}
async test() {
await this.callAsync();
}
}
produce the declaretion:
export class TestJS {
callAsync(): Promise<number>;
async test(): Promise<void>; --> error
}
but when a try to use this class I receive 'async' modifier cannot be used in an ambient context.ts(1040)
Expected behavior:
the TestJS.d.ts shouldn't contain async
Actual behavior:
TestJS.d.ts conteins async
Playground Link: code
Related Issues:
pocesar, TimvdLippe and KasparEtter
Metadata
Metadata
Assignees
Labels
Domain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specificallyGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do thischeckJsRelates to checking JavaScript using TypeScriptRelates to checking JavaScript using TypeScript