GithubHelp home page GithubHelp logo

Comments (5)

LinusBorg avatar LinusBorg commented on June 26, 2024

This is an issue with the rollup setup is essentially typechecking the generated code after template compilation - that code is not meant to be typechecked.

The mergeModels helper function is explicitly marked as internal because it's only used/inserted by the compiler and not considered a public API - so we don't want it to be exposed in vue's type declarations.

We 'strongly recommend using vue-tsc to generate type declarations instead:

https://vuejs.org/guide/typescript/overview.html#overview

If using SFCs, use the vue-tsc utility for command line type checking and type declaration generation. vue-tsc is a wrapper around tsc, TypeScript's own command line interface. It works largely the same as tsc except that it supports Vue SFCs in addition to TypeScript files. You can run vue-tsc in watch mode in parallel to the Vite dev server, or use a Vite plugin like vite-plugin-checker which runs the checks in a separate worker thread.

from core.

yyx990803 avatar yyx990803 commented on June 26, 2024

This is a wontfix. Like @LinusBorg said, type checking should only happen to user-authored source code, not transformed / generated code.

from core.

SimmeNilsson avatar SimmeNilsson commented on June 26, 2024

Thank you both for the explanation.
If vue-tsc is the recommended path to generate the typings, what is the preferred way to generate the js-part for SFCs in a library?
Being able to do both in one step was the reason we went with rollup instead of vue-tsc in the first place.

from core.

yyx990803 avatar yyx990803 commented on June 26, 2024

Use Vite (which is using Rollup under the hood) + @vitejs/plugin-vue

If you have to stick to plain Rollup for some reason, you can use a Rollup plugin that only performs TS transpilation without type checking, e.g. https://www.npmjs.com/package/rollup-plugin-esbuild

from core.

SimmeNilsson avatar SimmeNilsson commented on June 26, 2024

Thank you! We've switched now. ๐Ÿ‘

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.