Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

vue-template-diagnostic

Example

import {
  createComponentHost,
  createTypeRepository,
  parseExpression,
  checkExpression
} from 'vue-template-diagnostic'

// Create TypeScript context
const checker = program.getTypeChecker()
const context = { ts, program, checker }

// Create a type repository
const repository = createTypeRepository(context)

// Get a TypeScript source file of a Vue.js component somehow
const source = program.getSourceFile('/path/to/component.ts')

// Create a component host
const host = createComponentHost(source, context)
if (host) {
  // Parse an expression in a Vue.js template
  const exp = parseExpression('"Hello, " + msg')

  if (!exp.failed) {
    // Check the parsed expression.
    // Must be provided a variables scope (you can use `host.members`)
    // and type repository
    const diagnostics = checkExpression(exp.value, host.members, repository)

    console.log(diagnostics)
  }
}

License

MIT

About

Diagnostic for expressions of Vue.js templates

Resources

License

Releases

No releases published

Sponsor this project

 

Packages

No packages published
You can’t perform that action at this time.