Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab65f42

Browse filesBrowse files
committed
fix: make props with default optional in TSX
1 parent 7b3029e commit ab65f42
Copy full SHA for ab65f42

File tree

Expand file treeCollapse file tree

2 files changed

+11
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-7
lines changed

‎src/helpers.ts

Copy file name to clipboardExpand all lines: src/helpers.ts
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ export function props<
115115
Props
116116
>
117117

118-
export function props<
119-
PropsOptions extends ComponentObjectPropsOptions,
120-
Props = Readonly<ExtractPropTypes<PropsOptions>>
121-
>(
118+
export function props<PropsOptions extends ComponentObjectPropsOptions>(
122119
propsOptions: PropsOptions
123120
): VueConstructor<
124-
Vue<Props, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps> &
125-
Props
121+
Vue<
122+
Readonly<ExtractPropTypes<PropsOptions, false>>,
123+
{},
124+
VNodeProps & AllowedComponentProps & ComponentCustomProps
125+
> &
126+
Readonly<ExtractPropTypes<PropsOptions>>
126127
>
127128

128129
export function props(

‎test-dts/jsx.tsx

Copy file name to clipboardExpand all lines: test-dts/jsx.tsx
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ describe('JSX', () => {
1010
required: true,
1111
},
1212

13-
optional: Number,
13+
optional: {
14+
type: Number,
15+
default: 0,
16+
},
1417
})
1518

1619
class App extends Props {}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.