𝘵𝘳𝘢𝘮𝘱𝘰𝘹
𝘵𝘳𝘢𝘮𝘱𝘰𝘹
Aarktype
Created by 𝘵𝘳𝘢𝘮𝘱𝘰𝘹 on 4/25/2025 in #questions
Unsatisfiable type
I'm trying to do this intersection, that should definitely work with typescript types, but is not working on arktype, and returning this error: Intersection of { client_id: string, code: string, grant_type: "authorization_code", redirect_uri: (In: string ) => Out<URL>, + (undeclared): delete } and { client_secret: string, code_verifier?: never, + (undeclared): delete } | { code_verifier: string, client_secret?: never, + (undeclared): delete } results in an unsatisfiable type. I've tested it in the playground and it works, but not in my code and I can't figure out why.
const secretOrVerifier = type(
{
"client_secret?": "never",
code_verifier: "string",
},
"|",
{
client_secret: "string",
"code_verifier?": "never",
},
);

export const Thing = type(
{
client_id: "string",
redirect_uri: "string.url.parse",
code: "string",
grant_type: "'authorization_code'",
},
"&",
secretOrVerifier,
);
const secretOrVerifier = type(
{
"client_secret?": "never",
code_verifier: "string",
},
"|",
{
client_secret: "string",
"code_verifier?": "never",
},
);

export const Thing = type(
{
client_id: "string",
redirect_uri: "string.url.parse",
code: "string",
grant_type: "'authorization_code'",
},
"&",
secretOrVerifier,
);
17 replies