Enable exactOptionalPropertyTypes in TypeScript #855
Labels
For: Backend
This is something to do for the backend (server folder) of the website.
Priority: Medium
Something that should be tried to be done in this release, but not as important as High priority.
Size: Small
Something that may take a day at most to do.
Type: Dev/Internal
Something that is more internal to development than end user facing.
This is a sensible flag that helps TS distinguish between fields that can be omitted and fields that can take a value of
undefined
. Enabling it stops you being able to set e.g.k?: string
toundefined
, and makes TypeScript's type inference when using index signatures a lot stronger - see microsoft/TypeScript#43947For us, it allows us to make nested interfaces containing optional values using
extends JsonObject
from type-fest, currently it just spews out errors about not being able to assign to some (e.g.string
) index type, see sindresorhus/type-fest#471 (comment) for details.TypeScript unfortunately doesn't have it on by default or in strict mode, but I'd definitely like to support it. I would add it right now, but it requires
--strictNullChecks
. So, once we finish #792, this is a freebie.I have to do a bunch of ugly
as unknown as MapZones
casts at the moment because of it, leaving comments everywhere that I am referencing this issue number. Once we tackle this, search for every instance and remove.The text was updated successfully, but these errors were encountered: