-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types): fix ComponentCustomProps augmentation (#9468)
close #8376
- Loading branch information
Showing
7 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# dts built-package test | ||
|
||
This package is private and for testing only. It is used to verify edge cases for external libraries that build their types using Vue core types - e.g. Vuetify as in [#8376](https://github.com/vuejs/core/issues/8376). | ||
|
||
When running the `build-dts` task, this package's types are built alongside other packages. Then, during `test-dts-only` it is imported and used in [`packages/dts-test/built.test-d.ts`](https://github.com/vuejs/core/blob/main/packages/dts-test/built.test-d.ts) to verify that the built types work correctly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "@vue/dts-built-test", | ||
"private": true, | ||
"types": "dist/dts-built-test.d.ts", | ||
"dependencies": { | ||
"@vue/shared": "workspace:*", | ||
"@vue/reactivity": "workspace:*", | ||
"vue": "workspace:*" | ||
}, | ||
"version": "3.3.6" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineComponent } from 'vue' | ||
|
||
const _CustomPropsNotErased = defineComponent({ | ||
props: {}, | ||
setup() {} | ||
}) | ||
|
||
// #8376 | ||
export const CustomPropsNotErased = | ||
_CustomPropsNotErased as typeof _CustomPropsNotErased & { | ||
foo: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { CustomPropsNotErased } from '@vue/dts-built-test' | ||
import { expectType, describe } from './utils' | ||
|
||
declare module 'vue' { | ||
interface ComponentCustomProps { | ||
custom?: number | ||
} | ||
} | ||
|
||
// #8376 - custom props should not be erased | ||
describe('Custom Props not erased', () => { | ||
expectType<number | undefined>(new CustomPropsNotErased().$props.custom) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.