twoslash icon indicating copy to clipboard operation
twoslash copied to clipboard

how to define plugins in compilerOptions

Open kravetsone opened this issue 1 year ago • 2 comments

// 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

{
  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
}

kravetsone avatar Mar 20 '24 12:03 kravetsone

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.

antfu avatar Mar 20 '24 13:03 antfu

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

kravetsone avatar Mar 20 '24 16:03 kravetsone