Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default values for tuple elements #951

Open
ssalbdivad opened this issue May 17, 2024 · 3 comments
Open

Default values for tuple elements #951

ssalbdivad opened this issue May 17, 2024 · 3 comments
Labels
external-contributor-friendly Doesn't rely heavily on contextual knowledge of ArkType (may still be complex)

Comments

@ssalbdivad
Copy link
Member

This would allow an expression like the following with the same semantics as the default value expressions currently available on object literals:

const t = type(["string", ["number", "=", 5]]);

type Expected = Type<[string, (In?: number | undefined) => Default<5>]>;

attest<[string, number?]>(o.inferIn);
attest<[string, number]>(o.infer);

See tests for object literals at ark/type/__tests__/defaults.test.ts.

@ssalbdivad ssalbdivad added the external-contributor-friendly Doesn't rely heavily on contextual knowledge of ArkType (may still be complex) label May 17, 2024
@renu-123-pixel
Copy link

hey @ssalbdivad can i work on this issue?

@ssalbdivad
Copy link
Member Author

@renu-123-pixel This issue is a lot more approachable than most other issues in the repo because all the correct behavior can be inferred from the object literal behavior, but it will still involve a fair amount of complex work with TypeScript and type-level functionality.

If you feel confident in those areas, feel free, but it might not be a good fit if you're new to the ecosystem.

@renu-123-pixel
Copy link

ok ! if u say so u can assign it to someone else ! As I'm literal noob!! Thank you for your response !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor-friendly Doesn't rely heavily on contextual knowledge of ArkType (may still be complex)
Projects
Status: Backlog
Development

No branches or pull requests

2 participants