Skip to content

Commit 39774a8

Browse files
committed
feat: make props type compatible with vue@3.0.0-rc.12
1 parent b5fdb9d commit 39774a8

File tree

5 files changed

+95
-93
lines changed

5 files changed

+95
-93
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"@microsoft/api-extractor": "^7.9.9",
5959
"@types/jest": "^26.0.10",
6060
"@types/node": "^14.6.0",
61-
"@vue/compiler-sfc": "^3.0.0-rc.8",
61+
"@vue/compiler-sfc": "^3.0.0-rc.12",
6262
"babel-jest": "^26.3.0",
6363
"babel-loader": "^8.1.0",
6464
"conventional-changelog-cli": "^2.1.0",
@@ -74,7 +74,7 @@
7474
"ts-loader": "^8.0.2",
7575
"typescript": "^4.0.2",
7676
"uglify-es": "^3.3.9",
77-
"vue": "^3.0.0-rc.8",
77+
"vue": "^3.0.0-rc.12",
7878
"vue-loader": "^16.0.0-beta.5",
7979
"webpack": "^4.44.1",
8080
"webpack-cli": "^3.3.12"

src/helpers.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import {
33
UnwrapRef,
44
ComponentObjectPropsOptions,
55
ExtractPropTypes,
6-
AllowedComponentProps,
7-
ComponentCustomProps,
8-
VNodeProps,
6+
ExtractDefaultPropTypes,
97
} from 'vue'
108

119
import {
@@ -108,23 +106,15 @@ export function mixins(...Ctors: VueMixin[]): VueConstructor {
108106
export function props<
109107
PropNames extends string,
110108
Props = Readonly<{ [key in PropNames]?: any }>
111-
>(
112-
propNames: PropNames[]
113-
): VueConstructor<
114-
Vue<Props, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps> &
115-
Props
116-
>
109+
>(propNames: PropNames[]): VueConstructor<Vue<Props> & Props>
117110

118-
export function props<PropsOptions extends ComponentObjectPropsOptions>(
111+
export function props<
112+
PropsOptions extends ComponentObjectPropsOptions,
113+
Props = Readonly<ExtractPropTypes<PropsOptions>>,
114+
DefaultProps = ExtractDefaultPropTypes<PropsOptions>
115+
>(
119116
propsOptions: PropsOptions
120-
): VueConstructor<
121-
Vue<
122-
Readonly<ExtractPropTypes<PropsOptions, false>>,
123-
{},
124-
VNodeProps & AllowedComponentProps & ComponentCustomProps
125-
> &
126-
Readonly<ExtractPropTypes<PropsOptions>>
127-
>
117+
): VueConstructor<Vue<Props, {}, DefaultProps> & Props>
128118

129119
export function props(
130120
propsOptions: string[] | ComponentObjectPropsOptions

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export {
2424
VueConstructor,
2525
EmitsOptions,
2626
ObjectEmitsOptions,
27+
PublicProps,
2728
} from './vue'
2829

2930
export {

src/vue.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export interface VueStatic {
8787
registerHooks(keys: string[]): void
8888
}
8989

90+
export type PublicProps = VNodeProps &
91+
AllowedComponentProps &
92+
ComponentCustomProps
93+
9094
export type VueBase = Vue<unknown, never[]>
9195

9296
export type VueMixin<V extends VueBase = VueBase> = VueStatic & { prototype: V }
@@ -119,11 +123,18 @@ export type EmitsOptions = ObjectEmitsOptions | string[]
119123
export type Vue<
120124
Props = unknown,
121125
Emits extends EmitsOptions = {},
122-
PublicProps = Props &
123-
VNodeProps &
124-
AllowedComponentProps &
125-
ComponentCustomProps
126-
> = ComponentPublicInstance<Props, {}, {}, {}, {}, Emits, PublicProps> &
126+
DefaultProps = {}
127+
> = ComponentPublicInstance<
128+
Props,
129+
{},
130+
{},
131+
{},
132+
{},
133+
Emits,
134+
PublicProps,
135+
DefaultProps,
136+
true
137+
> &
127138
ClassComponentHooks
128139

129140
export interface VueConstructor<V extends VueBase = Vue> extends VueMixin<V> {

yarn.lock

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,83 +1342,83 @@
13421342
dependencies:
13431343
"@types/yargs-parser" "*"
13441344

1345-
"@vue/compiler-core@3.0.0-rc.10":
1346-
version "3.0.0-rc.10"
1347-
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.10.tgz#a76f713fb0462429ec0ec10a472fff1f539c5772"
1348-
integrity sha512-kQzHzRsM0NPAWHeqSTb2J4VsHhjRkGeLTsGzeMnW+sojgTnS3T94KacwvYgVS4qeZAKiDq0bMNZoJWrHVQ3T8g==
1345+
"@vue/compiler-core@3.0.0-rc.12":
1346+
version "3.0.0-rc.12"
1347+
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.12.tgz#eb26ff2f7e0eb8b362606228b2dda59c0c914f63"
1348+
integrity sha512-TuOmPb5SXgK9qD/AAmy46j80CyKThiBppcgNIJTax1ZWLEtCU8JejXOJqXFcqDUrBJPy7WVtZWRjMsiZBjIlrQ==
13491349
dependencies:
1350-
"@babel/parser" "^7.10.4"
1351-
"@babel/types" "^7.10.4"
1352-
"@vue/shared" "3.0.0-rc.10"
1350+
"@babel/parser" "^7.11.5"
1351+
"@babel/types" "^7.11.5"
1352+
"@vue/shared" "3.0.0-rc.12"
13531353
estree-walker "^2.0.1"
13541354
source-map "^0.6.1"
13551355

1356-
"@vue/compiler-dom@3.0.0-rc.10":
1357-
version "3.0.0-rc.10"
1358-
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.10.tgz#dd1380d1ee61170de76f9eb91e0d8ac7985f0ae0"
1359-
integrity sha512-pqIUf5leZm0P9379utrRSVBMxhV8XaqJTEFFp5etCtbEa/H5ALs29EjFMtMcm9sQaVkZlKLu86mgIacbYB9Q3w==
1356+
"@vue/compiler-dom@3.0.0-rc.12":
1357+
version "3.0.0-rc.12"
1358+
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.12.tgz#b8468cb3f81d43ca25592026482e1330b99f2b8c"
1359+
integrity sha512-bCbXtJRYDaQL0e8i54rzUhmlB991ad08TAHiXyRK6ngTj9pO6lpJNcaHIeeOEv9gaZ6iUC7pEYtmC0708KkqDg==
13601360
dependencies:
1361-
"@vue/compiler-core" "3.0.0-rc.10"
1362-
"@vue/shared" "3.0.0-rc.10"
1361+
"@vue/compiler-core" "3.0.0-rc.12"
1362+
"@vue/shared" "3.0.0-rc.12"
13631363

1364-
"@vue/compiler-sfc@^3.0.0-rc.8":
1365-
version "3.0.0-rc.10"
1366-
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.10.tgz#4351ece66cdf4d758877482f69421c43d994dbaf"
1367-
integrity sha512-VIJ+VXqeM7WoRNgD9uYSARVb6CYq+JS2NNHfeerfNc7Uk3pjYHRv1MwEicAvN6zWFm5GLC1ZYTVD+WFg3xGAkQ==
1364+
"@vue/compiler-sfc@^3.0.0-rc.12":
1365+
version "3.0.0-rc.12"
1366+
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.12.tgz#eff29e9688b8ed840506d88b94336689cf2970f2"
1367+
integrity sha512-lHy0LK33KjVBeu6aCX0oLUSZtatOIY/1w927Fh5nFrN1SNnqA31q2wg/IDmvNU6+Y6F3s0MZyN5H6dyZgO5r/g==
13681368
dependencies:
1369-
"@babel/parser" "^7.10.4"
1370-
"@babel/types" "^7.10.4"
1371-
"@vue/compiler-core" "3.0.0-rc.10"
1372-
"@vue/compiler-dom" "3.0.0-rc.10"
1373-
"@vue/compiler-ssr" "3.0.0-rc.10"
1374-
"@vue/shared" "3.0.0-rc.10"
1375-
consolidate "^0.15.1"
1369+
"@babel/parser" "^7.11.5"
1370+
"@babel/types" "^7.11.5"
1371+
"@vue/compiler-core" "3.0.0-rc.12"
1372+
"@vue/compiler-dom" "3.0.0-rc.12"
1373+
"@vue/compiler-ssr" "3.0.0-rc.12"
1374+
"@vue/shared" "3.0.0-rc.12"
1375+
consolidate "^0.16.0"
13761376
estree-walker "^2.0.1"
13771377
hash-sum "^2.0.0"
13781378
lru-cache "^5.1.1"
13791379
magic-string "^0.25.7"
13801380
merge-source-map "^1.1.0"
1381-
postcss "^7.0.27"
1382-
postcss-modules "^3.1.0"
1381+
postcss "^7.0.32"
1382+
postcss-modules "^3.2.2"
13831383
postcss-selector-parser "^6.0.2"
13841384
source-map "^0.6.1"
13851385

1386-
"@vue/compiler-ssr@3.0.0-rc.10":
1387-
version "3.0.0-rc.10"
1388-
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.10.tgz#95a5f6b65b19a514c94f056994ec144b3b1b03ae"
1389-
integrity sha512-JBPil8sO5j7puB8acX2CQMRXEYB/EP8PoEur7RcF/+aqATI7C4yqWcSLC5TRJpigj6xE6ku6sx8om+j7ZHvgBw==
1386+
"@vue/compiler-ssr@3.0.0-rc.12":
1387+
version "3.0.0-rc.12"
1388+
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.12.tgz#ea37bfb616d90c376a5ef40bc65c57514bb6fef3"
1389+
integrity sha512-mJkTLS91Ji7ahZT8tuYnXJ+C0dzpwq6uIILVx2e82jHzPQ2Yl0owK5wVGJR1Kuy5ZT+9AczyyBgvxGiZjsFzdw==
13901390
dependencies:
1391-
"@vue/compiler-dom" "3.0.0-rc.10"
1392-
"@vue/shared" "3.0.0-rc.10"
1391+
"@vue/compiler-dom" "3.0.0-rc.12"
1392+
"@vue/shared" "3.0.0-rc.12"
13931393

1394-
"@vue/reactivity@3.0.0-rc.10":
1395-
version "3.0.0-rc.10"
1396-
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-rc.10.tgz#34d5f51bcc5a7c36e27d7a9c1bd7a3d25ffa7c56"
1397-
integrity sha512-mkUZfOJlbqGZx2cARmhCs5r2+xLJPL7VFNagmlA3Fd66ZXBc3ZvTQdYsY4VUbYJFe5ByIzqu9TZiAkzXY+JVaA==
1394+
"@vue/reactivity@3.0.0-rc.12":
1395+
version "3.0.0-rc.12"
1396+
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-rc.12.tgz#9f5c6da78729fe80cc47d23bc8b6c09b36998a29"
1397+
integrity sha512-Cz2wwwH7QpG2BDmmZ9Lia+soji9i3QjzMf1Mko3kIEHHGkeid6OxOaMXBEMCJjAyiRt+1VTHBZv6FgsUJeaDAQ==
13981398
dependencies:
1399-
"@vue/shared" "3.0.0-rc.10"
1399+
"@vue/shared" "3.0.0-rc.12"
14001400

1401-
"@vue/runtime-core@3.0.0-rc.10":
1402-
version "3.0.0-rc.10"
1403-
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-rc.10.tgz#9055aef5113cbc328aaec29760c2151e0ed3cf40"
1404-
integrity sha512-VK/kq4gDDoqZ45CVwdbLLpikXLYLCt6YLhdgXX3fhf20gvPqrbEZv1ZNLruNnhhTpf9cLyU4tZ18DHeaUYPziw==
1401+
"@vue/runtime-core@3.0.0-rc.12":
1402+
version "3.0.0-rc.12"
1403+
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-rc.12.tgz#021dbfabe5f50043790fb80d5235b6cedb3de4ac"
1404+
integrity sha512-RHt02volaaXwbkS3RJpLVSZm/qRQgqwB0ThWNlfb+FKcLwr1Bcyu08yrUXv2QI2mMbV4f/zInk6S44eUuuDcyg==
14051405
dependencies:
1406-
"@vue/reactivity" "3.0.0-rc.10"
1407-
"@vue/shared" "3.0.0-rc.10"
1406+
"@vue/reactivity" "3.0.0-rc.12"
1407+
"@vue/shared" "3.0.0-rc.12"
14081408

1409-
"@vue/runtime-dom@3.0.0-rc.10":
1410-
version "3.0.0-rc.10"
1411-
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-rc.10.tgz#50f95cb991483a4262163723320967ad17bb321f"
1412-
integrity sha512-bH4GuneHt3FQ+/21jba5orM/CO9N1cnT7J3wtrxopFJ4/4H5cvHXyG6v+ZVTu1d733Ij/6yMRA7xbtfi9a4zJw==
1409+
"@vue/runtime-dom@3.0.0-rc.12":
1410+
version "3.0.0-rc.12"
1411+
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-rc.12.tgz#cdc197736d6092bfcc39bdf50349a28f175d2103"
1412+
integrity sha512-CeJ+CxeE1nBIGd4OFiYHCyiXtnBZAvLCA+yq4IKnCn0IHwJVZJCpwXe8VvE7eU3eqNYatqN65kt6QgrYzu6m+Q==
14131413
dependencies:
1414-
"@vue/runtime-core" "3.0.0-rc.10"
1415-
"@vue/shared" "3.0.0-rc.10"
1414+
"@vue/runtime-core" "3.0.0-rc.12"
1415+
"@vue/shared" "3.0.0-rc.12"
14161416
csstype "^2.6.8"
14171417

1418-
"@vue/shared@3.0.0-rc.10":
1419-
version "3.0.0-rc.10"
1420-
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-rc.10.tgz#e7ab62abcabbfc738545902b96a3aa78f59f3286"
1421-
integrity sha512-fI6gVhhgb3cAmEkY4oeVVA2hWZ2xvkgogHdBI5PL7gSvZnOB6XZ2eQGsYjC4W+7BegvEkoMBuZsFXVa4ZQ07XQ==
1418+
"@vue/shared@3.0.0-rc.12":
1419+
version "3.0.0-rc.12"
1420+
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-rc.12.tgz#b114d999d6f51191f4ff6b284fa7bddf4c8589bc"
1421+
integrity sha512-UwkiTl7XVQ3vu22t7JgUGLNXSxvsr500W43V2I1N4B3vxBRGB1OLzCjGPtXMIXtWhZlaaZzivEU1zmr5sqmgaw==
14221422

14231423
"@webassemblyjs/ast@1.9.0":
14241424
version "1.9.0"
@@ -1921,7 +1921,7 @@ bindings@^1.5.0:
19211921
dependencies:
19221922
file-uri-to-path "1.0.0"
19231923

1924-
bluebird@^3.1.1, bluebird@^3.5.5:
1924+
bluebird@^3.5.5, bluebird@^3.7.2:
19251925
version "3.7.2"
19261926
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
19271927
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
@@ -2409,12 +2409,12 @@ console-browserify@^1.1.0:
24092409
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336"
24102410
integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==
24112411

2412-
consolidate@^0.15.1:
2413-
version "0.15.1"
2414-
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7"
2415-
integrity sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==
2412+
consolidate@^0.16.0:
2413+
version "0.16.0"
2414+
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.16.0.tgz#a11864768930f2f19431660a65906668f5fbdc16"
2415+
integrity sha512-Nhl1wzCslqXYTJVDyJCu3ODohy9OfBMB5uD2BiBTzd7w+QY0lBzafkR8y8755yMYHAaMD4NuzbAw03/xzfw+eQ==
24162416
dependencies:
2417-
bluebird "^3.1.1"
2417+
bluebird "^3.7.2"
24182418

24192419
constants-browserify@^1.0.0:
24202420
version "1.0.0"
@@ -5717,7 +5717,7 @@ postcss-modules-values@^3.0.0:
57175717
icss-utils "^4.0.0"
57185718
postcss "^7.0.6"
57195719

5720-
postcss-modules@^3.1.0:
5720+
postcss-modules@^3.2.2:
57215721
version "3.2.2"
57225722
resolved "https://registry.yarnpkg.com/postcss-modules/-/postcss-modules-3.2.2.tgz#ee390de0f9f18e761e1778dfb9be26685c02c51f"
57235723
integrity sha512-JQ8IAqHELxC0N6tyCg2UF40pACY5oiL6UpiqqcIFRWqgDYO8B0jnxzoQ0EOpPrWXvcpu6BSbQU/3vSiq7w8Nhw==
@@ -5746,7 +5746,7 @@ postcss-value-parser@^4.1.0:
57465746
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
57475747
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==
57485748

5749-
postcss@^7.0.14, postcss@^7.0.27, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6:
5749+
postcss@^7.0.14, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6:
57505750
version "7.0.32"
57515751
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.32.tgz#4310d6ee347053da3433db2be492883d62cec59d"
57525752
integrity sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==
@@ -7312,14 +7312,14 @@ vue-loader@^16.0.0-beta.5:
73127312
merge-source-map "^1.1.0"
73137313
source-map "^0.6.1"
73147314

7315-
vue@^3.0.0-rc.8:
7316-
version "3.0.0-rc.10"
7317-
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.10.tgz#31298a757b4fad6ee8973d0fa27c4fde8574bd01"
7318-
integrity sha512-nRsyIQtOWLDMBb5dsPwg/WdIqznCMVWN6O6wJSzhseKC768wHlZKcJ7SPHhWPid9wi3Ykhtl9vtgvxTK/qICkw==
7315+
vue@^3.0.0-rc.12:
7316+
version "3.0.0-rc.12"
7317+
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.12.tgz#08849531c9255f290b552912ae52802c5bc323d5"
7318+
integrity sha512-T/oWhPRPzIRzPvTjf9mI8oENYlAPr9ThB4JAJXJE3dlRAN7lYzH+eh4yBGR9EsyC+pIEAabP/cnM19dcJBNl3A==
73197319
dependencies:
7320-
"@vue/compiler-dom" "3.0.0-rc.10"
7321-
"@vue/runtime-dom" "3.0.0-rc.10"
7322-
"@vue/shared" "3.0.0-rc.10"
7320+
"@vue/compiler-dom" "3.0.0-rc.12"
7321+
"@vue/runtime-dom" "3.0.0-rc.12"
7322+
"@vue/shared" "3.0.0-rc.12"
73237323

73247324
w3c-hr-time@^1.0.2:
73257325
version "1.0.2"

0 commit comments

Comments
 (0)