Skip to content

refactor(tsc): rework based on first-party TS API#3795

Merged
johnsoncodehk merged 4 commits intots-pluginfrom
tsc-refactor
Dec 12, 2023
Merged

refactor(tsc): rework based on first-party TS API#3795
johnsoncodehk merged 4 commits intots-pluginfrom
tsc-refactor

Conversation

@johnsoncodehk
Copy link
Copy Markdown
Member

  • vue-tsc core code is re-implemented based on createProgram API
  • Instead of additionally importing typescript, capture the typescript method from the tsc.js context:
    var ts = new Proxy({}, { get(_target, p, _receiver) {return eval(p); } } )
  • Language-agnostic parts have been moved to @volar/typescript feat(typescript): add preset implementations volarjs/volar.js#108
  • vue-tsc is consistent with the typescript plugin. It no longer distinguishes between .vue and .vue.ts file names. Instead, it uses the .vue file name uniformly, but provides the content of .vue.ts. This should resolve perf(tsc): support vue files with project reference delcaration #3751
  • The tsc context is missing some typescript methods, and language-core needs to avoid using the missing methods:
    • node.forEachChild -> ts.forEachChild(node, ...
    • node.text -> sourceFile.text.substring(...)
    • sourceFile.getChildCount() -> ast.statements.length
    • node.getStart() -> ts.getTokenPosOfNode(node, sourceFile)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant