CodeHz
CodeHz
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
chrome 80 in android emulator, I use it as baseline
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
if you selected tracked mobile for .map you will get 99.91% + 0.09% = 100%
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
but it at least won't affect mobile user, they cannot upgrade the browser easily
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
yes, if do a proper transpile, we need store it in a local variable to prevent eval twice
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
caniuse report this feature is only valid for 93.4% of global users... https://caniuse.com/?search=??%3D (and https://caniuse.com/?search=?.
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
I will make a PR if needed
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
diff --git a/out/roots/alias.js b/out/roots/alias.js
index 49a873ae99455726e8d6d619268ee6fe73b92ed5..99c3e9d7c0bb7f7104ee58b6ba6dffb4dee71034 100644
--- a/out/roots/alias.js
+++ b/out/roots/alias.js
@@ -54,8 +54,9 @@ export class AliasNode extends BaseRoot {
this.resolution.traverseApply(data, ctx);
};
compile(js) {
- js.if(`ctx.seen.${this.id}?.includes(data)`, () => js.return(true));
- js.line(`ctx.seen.${this.id} ??= []`).line(`ctx.seen.${this.id}.push(data)`);
+ js.if(`ctx.seen.${this.id} && ctx.seen.${this.id}.includes(data)`, () => js.return(true));
+ js.if(`ctx.seen.${this.id} == undefined`, () => js.line(`ctx.seen.${this.id} = []`))
+ js.line(`ctx.seen.${this.id}.push(data)`);
js.return(js.invoke(this.resolution));
}
}
diff --git a/out/roots/alias.js b/out/roots/alias.js
index 49a873ae99455726e8d6d619268ee6fe73b92ed5..99c3e9d7c0bb7f7104ee58b6ba6dffb4dee71034 100644
--- a/out/roots/alias.js
+++ b/out/roots/alias.js
@@ -54,8 +54,9 @@ export class AliasNode extends BaseRoot {
this.resolution.traverseApply(data, ctx);
};
compile(js) {
- js.if(`ctx.seen.${this.id}?.includes(data)`, () => js.return(true));
- js.line(`ctx.seen.${this.id} ??= []`).line(`ctx.seen.${this.id}.push(data)`);
+ js.if(`ctx.seen.${this.id} && ctx.seen.${this.id}.includes(data)`, () => js.return(true));
+ js.if(`ctx.seen.${this.id} == undefined`, () => js.line(`ctx.seen.${this.id} = []`))
+ js.line(`ctx.seen.${this.id}.push(data)`);
js.return(js.invoke(this.resolution));
}
}
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
I just patched the source code and it is working again
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
So we cannot transpile it
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
It is generated code in runtime by arktype
26 replies
Aarktype
Created by CodeHz on 9/12/2024 in #questions
Got syntax error in some browser
https://github.com/arktypeio/arktype/blob/main/ark/schema/roots/alias.ts#L116 the ?. and ??= isn’t supported in some older browsers
26 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
No description
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
the backend API use boolean, and I don't want to use two different types for it..
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
yes, I think it would be perfect
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
runtime error: Default values must be specified on objects like { isAdmin: 'boolean = false' }
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
'default?' also doen't work
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
No description
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
arktype=2.0.0-beta.5
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
it just dont work
42 replies
Aarktype
Created by CodeHz on 8/18/2024 in #questions
How to handle checkbox in type('parse.formData').to(...)
No description
42 replies