Skip to content

Commit ab65f42

Browse files
committed
fix: make props with default optional in TSX
1 parent 7b3029e commit ab65f42

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/helpers.ts

Lines 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

Lines 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)