Comments (6)
@LinusBorg could you help transfer this to vuejs/vue? thanks.
from vue.
@xiaoxiangmoe Seemed to be a vue2 type issue. It doesn't convert emits to props
from vue.
? Are you GPT?
from vue.
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.
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.
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)
- Type augmentation is broken when using typescript's moduleResolution: "Bundler" option
- [Docs] $emit('input', value) cancels event.preventDefault() HOT 1
- named slot + forceUpdate dont work HOT 2
- <percentage> in css @property is handled incorrectly after run build HOT 2
- `triggerRef` does not trigger `watch` HOT 4
- vue的tags组件router-link标签跳转已打开页面不重新加载数据,有什么好方法吗? HOT 2
- Vue2.7 defineEmits/defineProps compile error HOT 6
- Vue 2.7.16 bug: Some types has not export
- Version 2.7.15 introduced breaking changes about getCurrentScope HOT 2
- $forceUpdate causes getCurrentScope to get an incorrect value HOT 2
- Missing "./types" specifier in "vue" package, how to use withDefaults in Vue2.7.15 with ts setup HOT 1
- When ref and reactive are used together with computed and watch, computed loses its effect. HOT 2
- Using v-show and :style="display: 'block'" simultaneously does not yield the expected results in version 2.7.16. HOT 5
- function setCurrentInstance(vm) crashes when vm._scope is undefined HOT 2
- 如果只是在某个方法调用时写jsx也是需要这样写吗?
- Component caching - wrong type returned in a `set` method HOT 1
- Dynamic component not rendering slot tree HOT 1
- Urgent: Black Duck Vulnerability Fix Needed for 'vue-template-compiler' HOT 1
- Why does manipulating the style property of the DOM not take effect? HOT 1
- Memory leak when using functional components in Vue 2.7.14 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue.