SynthLuvr
SynthLuvr
Aarktype
Created by SynthLuvr on 9/6/2024 in #questions
Type instantiation is excessively deep and possibly infinite
What would be cool is if we could do type("bigint>0n")
52 replies
Aarktype
Created by SynthLuvr on 9/6/2024 in #questions
Type instantiation is excessively deep and possibly infinite
I'm pretty sure it worked in the past but I don't know when
52 replies
Aarktype
Created by SynthLuvr on 9/4/2024 in #questions
Record with number as key?
Also:
const B = ark.Record("number", "number");
const B = ark.Record("number", "number");
Argument of type '["number", "number"]' is not assignable to parameter of type '["number", "number"] & [ErrorType<"Invalid argument for K", [expected: Key]>, unknown]'.
Type '["number", "number"]' is not assignable to type '[ErrorType<"Invalid argument for K", [expected: Key]>, unknown]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'string' is not assignable to type 'ErrorType<"Invalid argument for K", [expected: Key]>'
Argument of type '["number", "number"]' is not assignable to parameter of type '["number", "number"] & [ErrorType<"Invalid argument for K", [expected: Key]>, unknown]'.
Type '["number", "number"]' is not assignable to type '[ErrorType<"Invalid argument for K", [expected: Key]>, unknown]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'string' is not assignable to type 'ErrorType<"Invalid argument for K", [expected: Key]>'
6 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
For my purposes, I was able to create a workaround:
import { ArkErrors } from "arktype";

// Define a separate AnyType due to:
// https://github.com/arktypeio/arktype/issues/1117
type AnyType<T = unknown> = {
(data: unknown): T | ArkErrors;
describe: (description: string) => AnyType<T>;
description: string;
infer: unknown;
json: unknown;
};

export { AnyType };
import { ArkErrors } from "arktype";

// Define a separate AnyType due to:
// https://github.com/arktypeio/arktype/issues/1117
type AnyType<T = unknown> = {
(data: unknown): T | ArkErrors;
describe: (description: string) => AnyType<T>;
description: string;
infer: unknown;
json: unknown;
};

export { AnyType };
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
Argument of type 'Type<(In: string) => Out<string>, {}>' is not assignable to parameter of type 'Any<any>'.
Types of property 'out' are incompatible.
Type 'Type<unknown, {}>' is missing the following properties from type 'Type<any, any>': matching, atLeastLength, atMostLength, moreThanLength, and 2 more.ts(2345)
Argument of type 'Type<(In: string) => Out<string>, {}>' is not assignable to parameter of type 'Any<any>'.
Types of property 'out' are incompatible.
Type 'Type<unknown, {}>' is missing the following properties from type 'Type<any, any>': matching, atLeastLength, atMostLength, moreThanLength, and 2 more.ts(2345)
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
For example:
const m = <t extends Type.Any>(type: t): t => type.describe("test");
const a = type("string").pipe((s) => s);
const t = m(a);
const m = <t extends Type.Any>(type: t): t => type.describe("test");
const a = type("string").pipe((s) => s);
const t = m(a);
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
grr yeah so now I need to know the type ahead of the call so I can set the correct generic
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
So that's causing me a ton of problems
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
It now seems to be infering as Type.Any for the generic parameter
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
Found 188 errors in 49 files.
Found 188 errors in 49 files.
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
This isn't working for my use case unfortunately
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Compiling to JavaScript results in `any` type
To reproduce:
import { type } from "arktype";

const Address = type("string").narrow(() => true);
type Address = typeof Address.in.infer;

export { Address }
import { type } from "arktype";

const Address = type("string").narrow(() => true);
type Address = typeof Address.in.infer;

export { Address }
3 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Type instantiation is excessively deep and possibly infinite
Ok I'll try
18 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Was `any` removed?
replacing any with unknown does work
15 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Was `any` removed?
like type(["number", "string", "any", "number"]) etc.
15 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Was `any` removed?
Mostly I would use this when I'm expecting a certain sized tuple and know/care about some of the properties
15 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Was `any` removed?
I could cast it, it's not a big deal, but wondering
15 replies
Aarktype
Created by SynthLuvr on 9/2/2024 in #questions
Was `any` removed?
unknown works but it's fundamentally different
15 replies
Aarktype
Created by SynthLuvr on 8/6/2024 in #questions
ArkType mutates original input?
Well this blew up. I understand the reasoning for mutation and I'm in agreement. It just needs to be documented. I've been using ArkType for a long time and I never considered it mutated the original object. If it was made clear, there wouldn't be an issue
74 replies