-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Payload type unknown when defining optional property? #214
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
Comments
Oh dear. What version of TS are you on? @phryneas , @Jessidhia : any ideas? |
Phew. Yup. The feature detection for TS<3.5 was leaking both cases (TS<3.5 and TS>=3.5), exposing the pre-3.5 behaviour. We can fix this for TS>=3.5, but in old versions this will be the behaviour if something possibly looks like an empty object. ( fixed TS version feature detection would look like this: export type AtLeastTS35<True, False> = [True, False][IsUnknown<ReturnType<<T>() => T>, 0, 1>] ) Question is: is it worth it supporting old TS versions, which should be our minimum requirement? I guess we should still support 3.4, which is from march 2019, even if it hurts a little :/ |
Yeah, 3.4 seems reasonable to support, even if it's a bit of a pain. |
I might be even able to fix it for pre-3.5... PR coming in. |
Fix published as 0.8.1. Hopefully that should resolve this - let us know if there's still an issue! |
Co-authored-by: Matt Sutkowski <[email protected]> Co-authored-by: Rob Clayburn <[email protected]> Co-authored-by: Lenz Weber <[email protected]> Co-authored-by: Lenz Weber <[email protected]> Co-authored-by: kahirokunn <[email protected]> Co-authored-by: DmitryScaletta <[email protected]> Co-authored-by: Guillaume FORTAINE <[email protected]> Co-authored-by: triou <[email protected]> Co-authored-by: Rob Clayburn <[email protected]> Co-authored-by: Shrugsy <[email protected]>
This is for version 0.8.0.
Somehow, if there is only one property and it's optional, it converts it type to
unknown
The text was updated successfully, but these errors were encountered: