jack
jack
Explore posts from servers
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
true true. thanks for the help!
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
why does the string literal avoid this? also while i'm here- is there a substantial difference btwn checking if the result is instanceof type.errors vs ArkErrors?
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
updating deps at 1am was a horrible idea
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
seems like mismatched versions in my monorepo caused this
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
ok, thank you. this is a tomorow issue then
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
just rolled back the version and it's still here. no idea when i introduced this since i thought that tsc has been completing no problem, but i guess not does anything look wrong here? if not i'll figure this out tomorrow, just wanna make sure nothing is immediately broken
{
"include": ["**/*.ts", "**/*.tsx", "**/*.mjs"],
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"isolatedModules": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ES2022",
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"noEmit": true
}
}
{
"include": ["**/*.ts", "**/*.tsx", "**/*.mjs"],
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"isolatedModules": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ES2022",
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"noEmit": true
}
}
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
ok 🤔 will dig into this
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
interesting
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
this repros
const AccessToken = type.string;
type AccessToken = typeof AccessToken.infer;
const RefreshToken = type.string;
type RefreshToken = typeof RefreshToken.infer;

export const Tokens = type({
access: AccessToken,
refresh: RefreshToken,
});
export type Tokens = typeof Tokens.infer;

function test( tokens: Partial<Tokens>) {
const test = Tokens(tokens);

if (test instanceof type.errors) {
return err(test.summary);
}

return ok(test);
}
const AccessToken = type.string;
type AccessToken = typeof AccessToken.infer;
const RefreshToken = type.string;
type RefreshToken = typeof RefreshToken.infer;

export const Tokens = type({
access: AccessToken,
refresh: RefreshToken,
});
export type Tokens = typeof Tokens.infer;

function test( tokens: Partial<Tokens>) {
const test = Tokens(tokens);

if (test instanceof type.errors) {
return err(test.summary);
}

return ok(test);
}
arktype 2.1.16
23 replies
Aarktype
Created by jack on 4/4/2025 in #questions
type narrow issue on result
the type it shows is basically the union of the success and error types
23 replies
Aarktype
Created by jack on 3/15/2025 in #questions
onfail without importing config in every file?
Oh I see, I didn't know .assert would behave that same way. Yea I'll just do that, that's more explicit anyway
5 replies
Aarktype
Created by jack on 3/15/2025 in #questions
onfail without importing config in every file?
it's not really clear what my app entry point is in some cases as i have a monorepo, but i'll try and see what happens, thank you
5 replies
Aarktype
Created by jack on 3/11/2025 in #questions
standard schema conforming schema in openauth not working seemingly exclusively with arktype?
thanks!
6 replies
Aarktype
Created by jack on 3/11/2025 in #questions
standard schema conforming schema in openauth not working seemingly exclusively with arktype?
sweet, works with the updated version (i also tried the alternative ^ and it did work too, but i like the inline 🙂 )
6 replies
Aarktype
Created by jack on 3/11/2025 in #questions
standard schema conforming schema in openauth not working seemingly exclusively with arktype?
2.0.4, updating now. was this a known issue?
6 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
(side note: this match function is really cool, and making me rethink what runtime validation actually means a bit. didn't consider ever using zod for something like this when i've used zod in the past instead of arktype, but in hindsight it totally makes sense)
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
yea that is true. will note down potentially for the future
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
i don't really need anything more fancy, just didn't want to hardcode the suffix value
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
ah i didn't think about pulling out the matcher. this looks good to me, thank you!!
57 replies
Aarktype
Created by francis on 3/1/2025 in #questions
New v2.1 arktype matcher: is there a way to match on string literal values?
this is what i've got working
const ImageSource = match({
"string.url & /=s96-c$/": (url) =>
url.slice(0, url.length - constants.googleThumbnailSuffix.length),
"string.url": (url) => url,
default: "assert",
});
const ImageSource = match({
"string.url & /=s96-c$/": (url) =>
url.slice(0, url.length - constants.googleThumbnailSuffix.length),
"string.url": (url) => url,
default: "assert",
});
just unfortunate part is i can't embed my constant value, so if it changes i don't get that for free here
57 replies