Asfamilybank
Asfamilybank
Aarktype
Created by Asfamilybank on 12/16/2024 in #questions
Why are the partial operator `?` and explicit `undefined` incompatible?
I define the type:
import { type } from 'arktype';

const checkType = type({
'redirect?': 'string'
});

checkType({}); // pass
checkType({ redirect: undefined }); // ArkTypeError
import { type } from 'arktype';

const checkType = type({
'redirect?': 'string'
});

checkType({}); // pass
checkType({ redirect: undefined }); // ArkTypeError
I don’t understand why it is designed like this, as far as I know, partial operator will accept explicit undefined in TypeScript. (or I’m wrong ?)🤨 #questions #typescript
17 replies