{"id":48296,"library":"json-schema-to-typescript-nullable","title":"json-schema-to-typescript-nullable","description":"Compile JSON Schema to TypeScript typings, with support for nullable types. Version 10.1.3. Stable release, actively maintained. Key differentiators: CLI tool, customizable output via Prettier style options, and support for $ref resolution, strict index signatures, and unknown type. Compatible with Node >=10.","status":"active","version":"10.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/ryank1m/json-schema-to-typescript","tags":["javascript","json","schema","typescript","compile","transpile","api","interface","typing"],"install":[{"cmd":"npm install json-schema-to-typescript-nullable","lang":"bash","label":"npm"},{"cmd":"yarn add json-schema-to-typescript-nullable","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-schema-to-typescript-nullable","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Resolves $ref references in schemas","package":"@apidevtools/json-schema-ref-parser","optional":false},{"reason":"Formats generated TypeScript code","package":"prettier","optional":false}],"imports":[{"note":"Requires ESM or TypeScript. CommonJS require works but not recommended.","wrong":"const compile = require('json-schema-to-typescript').compile;","symbol":"compile","correct":"import { compile } from 'json-schema-to-typescript'"},{"note":"Same as compile, file-based input.","wrong":"const compileFromFile = require('json-schema-to-typescript').compileFromFile;","symbol":"compileFromFile","correct":"import { compileFromFile } from 'json-schema-to-typescript'"},{"note":"Default export is not the compile function; destructure required.","wrong":"const compile = require('json-schema-to-typescript');","symbol":"compile","correct":"const { compile } = require('json-schema-to-typescript');"}],"quickstart":{"code":"import { compile } from 'json-schema-to-typescript';\nimport * as fs from 'fs';\n\nconst schema = {\n  title: 'User',\n  type: 'object',\n  properties: {\n    name: { type: 'string' },\n    age: { type: 'integer' }\n  },\n  required: ['name']\n};\n\ncompile(schema, 'User').then((ts) => fs.writeFileSync('user.d.ts', ts));","lang":"typescript","description":"Compiles a JSON Schema object to a TypeScript interface and writes to file."},"warnings":[{"fix":"Set `unknownAny: false` in options if previous behavior is needed.","message":"In v10, the default value for `unknownAny` changed from `false` to `true`, causing `any` types to become `unknown`.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Install Prettier as a dependency or set `format: false`.","message":"The library uses Prettier for formatting; if Prettier is not installed, formatting may fail silently or produce unformatted output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use `refOptions` instead.","message":"The `$refOptions` option is deprecated in favor of using `refOptions` (lowercase r).","severity":"deprecated","affected_versions":">=10.0.0"}],"env_vars":null,"search_vec":"'10':48 '10.1.3':19 'activ':22 'api':55 'cli':26 'compat':45 'compil':7,53 'customiz':28 'differenti':25 'index':40 'interfac':56 'javascript':49 'json':2,8,50 'json-schema-to-typescript-nul':1 'key':24 'maintain':23 'node':47 'nullabl':6,16 'option':33 'output':29 'prettier':31 'ref':37 'releas':21 'resolut':38 'schema':3,9,51 'signatur':41 'stabl':20 'strict':39 'style':32 'support':14,35 'tool':27 'transpil':54 'type':12,17,44,57 'typescript':5,11,52 'unknown':43 'version':18 'via':30","created_at":"2026-06-07T16:55:54.948856+00:00","updated_at":"2026-06-07T16:55:54.948856+00:00","problems":[{"fix":"Use named import: `import { compile } from 'json-schema-to-typescript'`.","cause":"Trying to import default export as named import.","error":"TypeError: Cannot destructure property 'compile' of 'undefined' or null."},{"fix":"Install prettier: `npm install prettier` or set `format: false`.","cause":"Prettier is not installed.","error":"Error: Cannot find module 'prettier'"},{"fix":"Ensure schema is a valid JSON Schema object.","cause":"Empty or undefined schema object passed to compile().","error":"Error: No schema provided"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ryank1m/json-schema-to-typescript#readme","github":"https://github.com/ryank1m/json-schema-to-typescript","docs":null,"changelog":null,"pypi":null,"npm":"json-schema-to-typescript-nullable","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devtools"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}