jsontypedef / json-typedef-js

A JavaScript / TypeScript implementation of JSON Type Definition
https://jsontypedef.com
MIT License
87 stars 3 forks source link

import Schema in javascript gives syntax error "SyntaxError: Named export 'Schema' not found" #50

Open chrisjameslennon opened 8 months ago

chrisjameslennon commented 8 months ago
import { Schema, validate } from "jtd";

in javascript (i.e. not typescript) gives runtime error SyntaxError: Named export 'Schema' not found. The requested module 'jtd' is a CommonJS module, which may not support all module.exports as named exports.

dragonofdeath commented 2 months ago

I guess 'Schema' is just typescript type so it doesn't have any representation on js side https://github.com/jsontypedef/json-typedef-js/blob/master/src/schema.ts#L18