typecheck.macro
typecheck.macro copied to clipboard
A easy (and fast) typescript validation library/macro. Automatically generate validation functions for Typescript types.
https://github.com/vedantroy/typecheck.macro/blob/c2c8b1938caf31f635b043c6d25cdece15d7c5e7/src/code-gen/irToInline.ts#L469
As suggested in the README, I'd like to express my wish for multi-file types support. My use case is the validation of data for React components. The types are simple,...
[See this](https://hackmd.io/44QmO77vS_ijgG9-dy-j-w?view) This library still needs a maintainer. Feel free to reach out if you want to take a shot at maintaining it. ~~Note, seems like [proteriax](https://github.com/proteriax) is now helping...
In a newly created CRA project, the following code ```ts type NumberContainer = { pos: Positive; } type Positive = number; registerType('NumberContainer') export const x = createValidator(undefined, { constraints: {...
Sometimes, I have a type `A` that might be used in other types. If I need to add constraints on that type, I would have to repeat those constraints every...
```ts // Use this to get an iterable of possible values. const namingConvention = ['snake_case', 'camelCase'] as const; type NamingConvention = typeof namingConvention[number]; registerType('NamingConvention'); export const isValidNamingConvention = createValidator(); ```...
I have an autogenerated type (by graphql codegen) like this: ```typescript /** Specifies the fields required to create a new customer. */ export type CustomerCreateInput = { /** The customer’s...
Small example: `src/mytypes.ts`: ``` import createValidator, { createDetailedValidator, registerType } from "typecheck.macro"; export type ProjectLayerConfig = { layers: Array; }; registerType("ProjectLayerConfig"); type Item = { id: string; label: string; isVisible:...
Mapped types are listed as `WIP`. What is the status of these types? - [ ] Record - [ ] Required - [ ] Pick - [ ] Omit
Support ```typescript type A = B & C; ``` and ```typescript interface Foo extends Bar {} ```