-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to return Promise<void> #51
Comments
Is there a workaround for this in place? |
I also run into this error with Promises that return export class PromiseOfUndefined {
async function returnsUndefinedPromise(): Promise<undefined> {
return;
}
} export class PromiseOfNull {
async function returnsNullPromise(): Promise<null> {
return;
}
} Using jsii 1.67.0. A possible workaround is to design around the API like so, though it might look unidiomatic for TypeScript/JavaScript users: export interface Nothing {}
export class PromiseOfNothing {
async function returnsNothingPromise(): Promise<Nothing> {
return;
}
} |
The
|
The void-check only accounted for the literal `void` type, but failed to account for the `Promise<void>` case. This is now fixed. Fixes #51
The void-check only accounted for the literal `void` type, but failed to account for the `Promise<void>` case. This is now fixed. Fixes #51 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
|
While methods are fine to return
void
, they cannot return aPromise<void>
, as JSII interprets this asPromise<unknown type>
.Reproduction:
The text was updated successfully, but these errors were encountered: