jacksteamdev
Aarktype
•Created by francis on 8/25/2024 in #questions
vscode intellisense errors on the same type definition in some files, but not others
tl;dr: If your Svelte project doesn't have a
svelte.config.js
file, add it.
The main problem was that the Svelte VS Code extension was casting inferred ArkType types to unknown in the editor.
My project was using Bun with a custom Svelte plugin to compile to JS - I didn't need a svelte.config.js
file to compile to JS, however, TypeScript was acting weird in Svelte files.
Downgrading the Svelte extension to ^108 got inferred types working, but I noticed that the extension was logging that it couldn't find a svelte.config.js
file, so I added one with svelte-preprocess
.
Everything is working as expected after upgrading the Svelte extension to the latest version.14 replies
Aarktype
•Created by francis on 8/25/2024 in #questions
vscode intellisense errors on the same type definition in some files, but not others
I've run into a similar problem with Svelte for VS Code. Quick fix was to downgrade the extension (svelte.svelte-vscode) to 108.6.1.
14 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
I think what I was looking for was essentially
if ... else
support for string matching:
Maybe subset matching... but I got there in the end.16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
@TizzySaurus Thanks for the help!
I wasn't able to get
type("keyof", weightAliases)
working, it requires weightAliases to be a Type, as is it can't resolve the property values.
I was able to reduce casting with type.enumerated(...weightNames)
and an Object.keys wrapper:
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
Right now I'm wrapping it in a function:
Which works, but I was curious if there was a better way to do it.
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
It's not exactly a minimal repro, sorry 😓
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
This is
toStringUnion
:
16 replies
Aarktype
•Created by jacksteamdev on 11/9/2024 in #questions
Union Fallthrough?
Hi @TizzySaurus !
My goal is to normalize recipe ingredient measurements before writing to the db. Later I have an SQL function that combines ingredients from different recipes into a grocery list.
16 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
do you want an issue for it, or do you think it's covered already?
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
lol, at least there's a workaround, no matter how ugly 👹
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
here's a fun one with private properties: https://stackblitz.com/edit/arktype-bug-rxgdqa?file=demo.ts
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
Nice, thanks!
23 replies
Aarktype
•Created by jacksteamdev on 8/8/2023 in #questions
How to validate that a value is an instance of a class
I came up with something like this:
23 replies