grantila / typeconv

Convert between JSON Schema, TypeScript, GraphQL, Open API and SureType
MIT License
421 stars 8 forks source link

Unable to convert `keyof typeof something` #30

Closed erkin98 closed 1 year ago

erkin98 commented 2 years ago

When converting to try something like this

export type DemoType = {
  name: keyof typeof something;
  class: string;
  Pure?: boolean;
}

it's converting this type to JSON but doesn't give a type field for the name. image

grantila commented 1 year ago

The conversion isn't parsing TypeScript code, only types. Basically, it can understand .d.ts, but not logic in .ts files.

If you run tsc to compile that file and generate a separate declaration file, that file can be used as input to typeconv.