bcherny / json-schema-to-typescript

Compile JSON Schema to TypeScript type declarations
https://bcherny.github.io/json-schema-to-typescript-browser/
MIT License
2.94k stars 391 forks source link

Error: Couldn't resolve parser "typescript". Parsers must be explicitly added to the standalone bundle. #379

Closed armenr closed 3 years ago

armenr commented 3 years ago

Howdy! I'm working with a 3rd party library that's a total mess.

What I'm dealing with:

I have an authentication service which runs a function and returns a user object. This user object has properties, values, and nested values/JSON that may change.

As such, I thought I'd be clever and use your library to do the following:

import { compile } from 'json-schema-to-typescript'

<...other stupid code...>

type authProfile= Record<string, unknown>

const currentUser: authProfile = await AuthSingleton.currentAuthenticatedUser()
const compiledAuthProfileTypes = await compile(currentUser, 'CurrentUser').then(ts => console.log(ts))

I am, unfortunately, getting the following in my console:

Error: Couldn't resolve parser "typescript". Parsers must be explicitly added to the standalone bundle.

This is inside of a Quasar v2 (beta) project, which is just Vue3 + Vuex4, and a bunch of other fancy bells & whistles the Quasar team slap on. It uses WebPack, and it installs/hides a bunch of dependencies and libraries (like TypeScript).

I thought I'd yarn add -D typescript to see if that would resolve the issue, but it did not :-\

My question might be stupid, so please forgive my newbishness.

marko-ignjatovic commented 3 years ago

@armenr try to disable in format in the options

Jcanno commented 3 years ago

@armenr try to disable in format in the options

that resolve my problem, nice!!!!