Git Product home page Git Product logo

Comments (6)

johnsoncodehk avatar johnsoncodehk commented on April 28, 2024 1

@LinusBorg could you help transfer this to vuejs/vue? thanks.

from vue.

so1ve avatar so1ve commented on April 28, 2024

@xiaoxiangmoe Seemed to be a vue2 type issue. It doesn't convert emits to props

from vue.

so1ve avatar so1ve commented on April 28, 2024

? Are you GPT?

from vue.

anden-akkio avatar anden-akkio commented on April 28, 2024

Also seeing something similar.

modules/src/components/CombinedModal.vue:94:14 - error TS2345: Argument of type '{ props: any; onClose: any; }' is not assignable to parameter of type 'Readonly<Partial<{ [x: number]: string; }> & Omit<Readonly<ExtractPropTypes<string[]>>, DefaultKeys<string[]>>> & Record<...>'.
  Type '{ props: any; onClose: any; }' is not assignable to type 'Readonly<Partial<{ [x: number]: string; }> & Omit<Readonly<ExtractPropTypes<string[]>>, DefaultKeys<string[]>>>'.
    Types of property 'toString' are incompatible.
      Type '() => string' is not assignable to type '(() => string) & string'.

94             <MergeModal @close="onClose" v-bind:props="props"></MergeModal>

Don't think I'm really doing anything special.

Shim file (removing doesn't seem to change anything):

declare module "*.vue" {
  import type { DefineComponent } from "vue";
  const component: DefineComponent;
  export default component;
}

Running type checking with vue-tsc --noEmit with this config file:

{
  "extends": "../tsconfig.json",
  "include": [
    "./types/shims-vue.d.ts",
    "./types/vuejs-datepicker.d.ts",
    "**/*.js", // required even if we're not directly type checking (see `allowJs` below)
    "**/*.ts",
    "**/*.vue"
  ],
  "compilerOptions": {
    "composite": true,
    "allowJs": true, // permits .ts/.vue files we're type checking to import .js files, enabling us to gradually add type checking w/o requiring an all-at-once migration. Worth noting that this is completely distinct from `checkJs`, which tells typescript to actually type check them.
    "types": [
      "vite/client" // Supports Vite's `import.meta.env`
    ],
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"]
    }
  }
}

Inheriting from this config file:

{
  "compilerOptions": {
    // Base options / sensible defaults that we want to pretty universally apply across all of our services
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}

from vue.

ZAID-BAARAB avatar ZAID-BAARAB commented on April 28, 2024

It seems like there is a type mismatch between the props defined in HelloWorld.vue and how it is being used in App.vue. You need to make sure that the props passed to the HelloWorld component match the expected props.

from vue.

so1ve avatar so1ve commented on April 28, 2024

In volar we convert v-on:xxx to onXxx and pass them as props to type-check required emits. Vue3 automatically converts events to props but vue2 doesn't. Just FYI @ZAID-BAARAB

from vue.

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.