Is this a bug or user error? Re: Generic Argument Validation
import { scope } from "arktype"
const versionScope = scope({
ProductHashKey: "string",
ProductSortKey: "string",
Product: {
HK: "ProductHashKey",
SK: "ProductSortKey",
banana: "true"
},
"MasterVersion<EntityType extends string, Entity extends Record<string, unknown>, HashKeyPattern, SortKeyPattern = StandardVersionSortKey>":
{
"...": "Entity",
HK: "HashKeyPattern",
SK: "SortKeyPattern",
entityType: "EntityType",
currentVersion: "number.integer",
},
ProductMaster: "MasterVersion<'Product', Product, ProductHashKey, ProductSortKey>"
})
import { scope } from "arktype"
const versionScope = scope({
ProductHashKey: "string",
ProductSortKey: "string",
Product: {
HK: "ProductHashKey",
SK: "ProductSortKey",
banana: "true"
},
"MasterVersion<EntityType extends string, Entity extends Record<string, unknown>, HashKeyPattern, SortKeyPattern = StandardVersionSortKey>":
{
"...": "Entity",
HK: "HashKeyPattern",
SK: "SortKeyPattern",
entityType: "EntityType",
currentVersion: "number.integer",
},
ProductMaster: "MasterVersion<'Product', Product, ProductHashKey, ProductSortKey>"
})
Type '"MasterVersion<'Product', Product, ProductHashKey, ProductSortKey>"' is not assignable to type '"MasterVersion<EntityType, Entity, HashKeyPattern, SortKeyPattern, =, StandardVersionSortKey> requires exactly 6 args (got 4: 'Product', Product, ProductHashKey, ProductSortKey) "'.(2322)
main.ts(19, 5): The expected type comes from property 'ProductMaster' which is declared here on type 'validate<{ readonly ProductHashKey: "string"; readonly ProductSortKey: "string"; readonly Product: { readonly HK: "ProductHashKey"; readonly SK: "ProductSortKey"; readonly banana: "true"; }; readonly "MasterVersion<EntityType extends string, Entity extends Record<string, unknown>, HashKeyPattern, SortKeyPattern = St...'
(property) ProductMaster: "MasterVersion<EntityType, Entity, HashKeyPattern, SortKeyPattern, =, StandardVersionSortKey> requires exactly 6 args (got 4: 'Product', Product, ProductHashKey, ProductSortKey) "
Type '"MasterVersion<'Product', Product, ProductHashKey, ProductSortKey>"' is not assignable to type '"MasterVersion<EntityType, Entity, HashKeyPattern, SortKeyPattern, =, StandardVersionSortKey> requires exactly 6 args (got 4: 'Product', Product, ProductHashKey, ProductSortKey) "'.(2322)
main.ts(19, 5): The expected type comes from property 'ProductMaster' which is declared here on type 'validate<{ readonly ProductHashKey: "string"; readonly ProductSortKey: "string"; readonly Product: { readonly HK: "ProductHashKey"; readonly SK: "ProductSortKey"; readonly banana: "true"; }; readonly "MasterVersion<EntityType extends string, Entity extends Record<string, unknown>, HashKeyPattern, SortKeyPattern = St...'
(property) ProductMaster: "MasterVersion<EntityType, Entity, HashKeyPattern, SortKeyPattern, =, StandardVersionSortKey> requires exactly 6 args (got 4: 'Product', Product, ProductHashKey, ProductSortKey) "
1 Reply
Ah, just realized it is the default. I guess that is not supported yet