You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
type reference inferred without | undefined without exactOptionalPropertyTypesΒ #1310
changed the title [-]Reuse type with "undefined" looses "undefined"[/-][+]type reference inferred without ` | undefined` without `exactOptionalPropertyTypes`[/+]on Feb 14, 2025
Won't be able to address this right away in 2.1.0 since the immediate solutions I found had significant performance overhead, but will try and find something that works well as a followup.
Activity
[-]reuse undefined type does not work[/-][+]Reuse type with "undefined" looses "undefined"[/+]ssalbdivad commentedon Feb 14, 2025
I can't reproduce this:
If you're still running into this issue locally, could you add a full repro?
flodlc commentedon Feb 14, 2025
We definitely don't have the same result.

I will try in a minimal repo. Could you send me your tsconfig ?
ssalbdivad commentedon Feb 14, 2025
It looks like this occurs with
"exactOptionalPropertyTypes": false.The docs recommend setting that flag to true, but
undefinedshould not be stripped here regardless.Will take a look and see if we can fix for the next release.
[-]Reuse type with "undefined" looses "undefined"[/-][+]type reference inferred without ` | undefined` without `exactOptionalPropertyTypes`[/+]flodlc commentedon Feb 14, 2025
Yes, I just got it too, setting "exactOptionalPropertyTypes": true makes it work.
Thanks for the very fast support and for your work.
flodlc commentedon Feb 14, 2025
Yes agree with this, it's actually not so obvious to set exactOptionalPropertyTypes to true in many projects.
ssalbdivad commentedon Feb 14, 2025
Won't be able to address this right away in 2.1.0 since the immediate solutions I found had significant performance overhead, but will try and find something that works well as a followup.
fix(type): keep a referenced Type's undefined without exactOptionalPrβ¦
docs(type): cite the issues the release fixes and add the entries it β¦
docs: cover upgrade breaks and a precompile refusal real projects hit
ssalbdivad commentedon Nov 18, 2026
Fixed in 3.0.0-beta.0 (#1728). Try it with
npm i arktype@next.