W
Windmill
W
Windmill
Parameter sets in TS
Original message was deleted
Windmill
Join
3,296
Members
View on Discord
S
Sindre
•
10/24/23, 7:19 PM
You want to provide only 1 of 4 params
?
Or is some of the fields conditional based on the others
?
A
Alper
•
10/24/23, 9:01 PM
if you can use an object for all params
, typescript can handle these requirements
.
made an example here
:
https://www.typescriptlang.org/play?#code/C4TwDgpgBAQghgZwgBTgJzgWwVAvFAbwCgoo4BjciBBAfWAHsBrCAOwC4oFg0BLVgOZEAvkSKhIUAMrA4wAK4JUGbHliIU6LDgBkhEl1kKEnAEQBBcsF4A3CKagAfKKYCSrCtbsPnpmA2AAC1MRMQloAGEGABNNFRx8eCRlbSg9YlJyGIhObj5BUPFwaGRAhlY41MSNFNV0gzAyityefiFRIslahOkjRW6nKCjYgedS8srsMQgADzAGNGAyBBBWcigAM3k163KoTDh+AAowLWxOboBKQmEgA
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way
.
A
Alper
•
10/25/23, 8:01 AM
made a refined example that shows you how to utilize an additional field with a constant value to get truly magnificent type checking
:
https://www.typescriptlang.org/play?#code/C4TwDgpgBAQghgZwgBTgJzgWwVAvFAbwCgoo4BjciBBAfWAHsBrCAOwC4oFg0BLVgOZEAvkSKhIUAMrA4wAK4JUGbHliIU6LDgBkhElAkROAIm5zFJgDQHzChKYCC5YLwBuEE1AA+UEwElWClcPL18TGAZgAAsTETEjKABhBgATTRUcfHgkZW0oPWJSI1NyNM8bUjL0zm4+QXjxcGhkaIZWDPzsjTzVQoMSvzA2jusDYfbjLh5+IVEmyV6s6Vl7JZ9k8vXfVsmlsQgADzAGNGAyBBBWcigAM3lr13aoTDh+AAowLWxOJYBKfSkXi3KCfb4IAB0iVw+DMq0sAKKpCgZVYCAYABsIBCMQwBGDMhC7Io-gZSAB6clQEAMeQouCsADk50U0C+hOq0FOUHZ2ghEw6UGiEDQEDJUEpyJMYDQDEgZxAUEZnMZUFSDGoUFYUSgR143Cgz0SjJkFiU4MZcWRKPa6KxOLxBL5nNJpGEuoxSCgwNBvOwUOaeFhnJMiPFqLt2Nx+L9kJdBndEE90B9Tv90NhAs8YetEcxUcdsf5Iwgrqg82EQA
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way
.
S
Sindre
•
10/25/23, 8:32 PM
@Craig could you post more of the code then that
. The snippet is too small to be able to help you
S
Sindre
•
10/25/23, 8:56 PM
Ahh sorry
. Then i misunderstood you
. On the phone
, but that seems right
.
S
Sindre
•
10/25/23, 8:57 PM
Ahh
. No you need
"
" around the keys I think to be 100
% valid JSON
S
Sindre
•
10/25/23, 9:03 PM
I think i asked the windmill overlord if it was possible to fix
. Its a small thing but its def a easy mistake to do
. a
.1
% DX improvemnt could be done
.
Let
's notified over supreme overload about it so he can
+1 the issue
-
@rubenf FYI
.
R
rubenf
•
10/25/23, 9:04 PM
someone called
?
R
rubenf
•
10/25/23, 9:06 PM
sorry I
'm not sure to see exactly the code that triggers the error
R
rubenf
•
10/25/23, 9:06 PM
to format well multiline
, you have to use triple quotes
R
rubenf
•
10/25/23, 9:08 PM
I
'm still confused
S
Sindre
•
10/25/23, 9:08 PM
Just that JSON has
" around keys
. So many places in general in the world they have a lax parsing and not that strict parsing of it
.
R
rubenf
•
10/25/23, 9:09 PM
Aaah
, yes those only accept valid json
R
rubenf
•
10/25/23, 9:09 PM
I understand this is frustrating if you
're used to javascript
R
rubenf
•
10/25/23, 9:10 PM
Rather than relaxing what we accept
, we can probably offer to autofix it
R
rubenf
•
10/25/23, 9:10 PM
I actually thought monaco would autofix in some cases
R
rubenf
•
10/25/23, 9:11 PM
anyway
, genie out
S
Sindre
•
10/25/23, 9:20 PM
No not really
. At runtime this is just JS not TS
. So the json is just json
.