{"version":3,"file":"json.mjs","sources":["../../src/predefined/json.mts"],"sourcesContent":["import { expectType } from 'ts-data-forge';\nimport {\n  type JsonPrimitive as JsonPrimitive_,\n  type JsonValue as JsonValue_,\n  type ReadonlyRecord,\n} from 'ts-type-forge';\nimport { array } from '../array/index.mjs';\nimport { union } from '../compose/index.mjs';\nimport { recursion } from '../other-types/index.mjs';\nimport { boolean, nullType, number, string } from '../primitives/index.mjs';\nimport { keyValueRecord } from '../record/index.mjs';\nimport { type Type, type TypeOf } from '../type.mjs';\n\nexport type JsonPrimitive = JsonPrimitive_;\n\nexport const JsonPrimitive = union([nullType, number(), string(), boolean()]);\n\nif (import.meta.vitest !== undefined) {\n  test('JsonPrimitive', () => {\n    expectType<TypeOf<typeof JsonPrimitive>, JsonPrimitive>('=');\n\n    expectType<JsonPrimitive, null | boolean | number | string>('=');\n\n    expect(JsonPrimitive.defaultValue).toBeNull();\n  });\n}\n\nexport type JsonValue = JsonValue_;\n\nexport const JsonValue: Type<JsonValue> = recursion('JsonValue', () =>\n  union([JsonPrimitive, keyValueRecord(string(), JsonValue), array(JsonValue)]),\n);\n\nif (import.meta.vitest !== undefined) {\n  test('JsonValue', () => {\n    expectType<TypeOf<typeof JsonValue>, JsonValue>('=');\n\n    expect(JsonValue.defaultValue).toBeNull();\n  });\n}\n\nexport type JsonObject = ReadonlyRecord<string, JsonValue>;\n\nexport const JsonObject = keyValueRecord(string(), JsonValue);\n"],"names":[],"mappings":";;;;;;;;;;;;MAea,aAAA,GAAgB,KAAA,CAAM,CAAC,QAAA,EAAU,MAAA,IAAU,MAAA,EAAO,EAAG,OAAA,EAAS,CAAC;AAcrE,MAAM,SAAA,GAA6B,SAAA;AAAA,EAAU,WAAA;AAAA,EAAa,MAC/D,KAAA,CAAM,CAAC,aAAA,EAAe,cAAA,CAAe,MAAA,EAAO,EAAG,SAAS,CAAA,EAAG,KAAA,CAAM,SAAS,CAAC,CAAC;AAC9E;AAYO,MAAM,UAAA,GAAa,cAAA,CAAe,MAAA,EAAO,EAAG,SAAS;;;;"}