twoslashes / twoslash

Markup for generating rich type information in your documentations ahead of time.
https://twoslash.netlify.app/
MIT License
506 stars 17 forks source link

how to define plugins in compilerOptions #29

Open kravetsone opened 6 months ago

kravetsone commented 6 months ago
// tsconfig.json
{
    "compilerOptions": {
        "jsx": "react",
        "jsxFactory": "Html.createElement",
        "jsxFragmentFactory": "Html.Fragment",
        "plugins": [{ "name": "@kitajs/ts-html-plugin" }]
    }
}
```tsx twoslash
// @jsx: react
// @jsxFactory: Html.createElement
// @jsxFragmentFactory: Html.Fragment
// @plugins: [{ "name": "@kitajs/ts-html-plugin" }]
// ---cut---
But i recieve
```ts
{
  title: 'Unknown primitive value in compiler flag',
  description: 'The only recognized primitives are number, string and boolean. Got object with [{ "name": "@kitajs/ts-html-plugin" }].',
  recommendation: 'This is likely a typo.',
  code: undefined
}
antfu commented 6 months ago

I never used TS plugins, but I guess you will need to pass it in JavaScript with the plugin instance rather than the plugin names.

kravetsone commented 6 months ago

I never used TS plugins, but I guess you will need to pass it in JavaScript with the plugin instance rather than the plugin names.

I am following the instructions from the README and would like to show what error the plugin throws

image

TS plugins info - https://www.typescriptlang.org/tsconfig#plugins https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin#whats-a-language-service-plugin