Skip to main content

ObjSchemaByKey

넘겨진 key 를 기반으로, 객체의 type 을 만들어 줍니다.

Signature

type ObjSchemaByKey<T extends string | number, Value = any> = T extends `${infer Key}.${infer Rest}` ? Key extends `${number}` ? ObjSchemaByKey<Rest, Value>[] : { [K in Key]?: ObjSchemaByKey<Rest, Value> } : { [K in T]?: Value };

References

ObjSchemaByKey

Example