PIat
PIat
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
Pretty readable too..?
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
It would be the technically correct way
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
Thank you too 😊
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
Should I file it?
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
Would look great, but it's not critical right now. It'd just be sugar. When handling uploads, you'd also check the MIME type and probably the actual contents, so at that point you'd create a narrow anyways
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
I really like having numbers be written in natural language. Had my share of 5 * 60 * 1000
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
If 1s it'll convert to 1000
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
When you insert 1000 it will convert to 1s
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
ms only returns string or number
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
Actually now that I'm thinking about it, only Arktype knows what the return value from the string would be 😁
41 replies
Aarktype
Created by ZX on 10/9/2024 in #questions
File type
I would definitely be using a utility function (similar to ms: https://www.npmjs.com/package/ms) to convert MB to bytes and using as const
type({
myFile: `File<${convertToBytes('30mb') as const}`
})
type({
myFile: `File<${convertToBytes('30mb') as const}`
})
Adding MB and/or KB would be a lot smoother DX
41 replies
Aarktype
Created by PIat on 10/9/2024 in #questions
Type definitions must be strings or objects (was undefined)
So it's not an Arktype error
18 replies
Aarktype
Created by PIat on 10/9/2024 in #questions
Type definitions must be strings or objects (was undefined)
I think I found it: With a model a utility function throws: TypeError: Cannot convert undefined or null to object
export function fromEnum<T extends object>(arg: T) {
return ['===', ...Object.values(arg)] as ['===', ...Array<T[keyof T]>]
}
export function fromEnum<T extends object>(arg: T) {
return ['===', ...Object.values(arg)] as ['===', ...Array<T[keyof T]>]
}
18 replies
Aarktype
Created by PIat on 10/9/2024 in #questions
Type definitions must be strings or objects (was undefined)
It's a runtime error
18 replies
Aarktype
Created by PIat on 10/9/2024 in #questions
Type definitions must be strings or objects (was undefined)
What about
type({})
type({})
Would this crash?
18 replies
Aarktype
Created by PIat on 10/9/2024 in #questions
Type definitions must be strings or objects (was undefined)
I am not sure what causes it, I will go through the types now and hopefully find it
18 replies
Aarktype
Created by PIat on 10/9/2024 in #questions
Type definitions must be strings or objects (was undefined)
During instantiation or assertion?
18 replies
Aarktype
Created by PIat on 10/8/2024 in #questions
Conform to an existing type
Will have this in the back of my mind for the future, thank you 😊
29 replies
Aarktype
Created by PIat on 10/8/2024 in #questions
Conform to an existing type
I think I get it now
29 replies
Aarktype
Created by PIat on 10/8/2024 in #questions
Conform to an existing type
Ooooh
29 replies