Reproduction Steps
Create a script with the following code:
--!strict
export type PromiseFor<T> = {
andThen: <U>(
self: PromiseFor<T>,
onFulfilled: ((result: T) -> U)?,
onRejected: ((err: string) -> U)?
) -> PromiseFor<U>,
catch: <U>(
self: PromiseFor<T>,
onRejected: ((err: string) -> U)?
) -> PromiseFor<U>,
finally: <U>(
self: PromiseFor<T>,
onResolvedOrRejected: ((wasFulfilled: boolean, resultOrErr: T | string) -> U)
) -> PromiseFor<U>,
}
This code is a few months old, and it describes a type of a “Promise” object, which can be chained with :andThen() and :catch() statements.
The code used to work without emitting any warnings, and now emits warnings for some reason:
If you type the PromiseFor<U>
return types as Promise<any>
, you get the same warning.
Expected Behavior
This type should be valid, and used to be valid.
Actual Behavior
The type is no longer valid.
why is there a character limit for each individual field in the bug report wizard
Workaround
The only workaround in this example is to type these PromiseFor<U>
return types as any
.
Issue Area: Studio
Issue Type: Other
Impact: Moderate
Frequency: Very Rarely
Date First Experienced: 2022-01-06 00:01:00 (-07:00)
Date Last Experienced: 2022-01-06 00:01:00 (-07:00)