Skip to content

Instantly share code, notes, and snippets.

@Quramy
Created January 4, 2018 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Quramy/48f30d06cb4cb06a622783045dd22ad7 to your computer and use it in GitHub Desktop.
Save Quramy/48f30d06cb4cb06a622783045dd22ad7 to your computer and use it in GitHub Desktop.
Generate .d.ts from JSON schema using @ngtools/json-schema
import { SchemaClassFactory } from '@ngtools/json-schema';
// Input JSON schema json file
const factory = SchemaClassFactory<any>(require('@angular/cli/lib/config/schema.json'));
const schemaClass = new factory(null);
// Output .d.ts
console.log(schemaClass.$$serialize('text/x.dts'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment