Skip to content

scriptSFC NPM Version

Stability: experimental ⚠️ Experimental feature, use at your risk

Enabled Volar support for .ts | .tsx files.

FeaturesSupported
Volar Plugin

Basic Usage

With jsxDirective

tsx
export default ({ foo }: { foo: number }) => (
  <div v-if={foo === 1}>{foo}</div>
  //                     ^ will be inferred as 1
)

Volar Configuration

tsconfig.json
jsonc
{
  "vueCompilerOptions": {
    "plugins": ["@vue-macros/volar"],
    "vueMacros": {
      "scriptSFC": true,
    },
  },
}

Contributors

Changelog