Skip to content

Commit c796283

Browse files
committed
Up version
1 parent 27baf01 commit c796283

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

example/src/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const examples = {
5050
},
5151
propsBinding: {
5252
name: 'Props Binding',
53-
description: 'To bind props to modal, need to declare the modal using jsx.',
53+
description: 'To bind props to modal, need to declare the modal using <ModalHolder />.',
5454
component: PropsBinding,
5555
code: ['PropsBinding.jsx'],
5656
},

example/src/TsTest.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This a test file to check if typescript is working properly
2-
2+
import React from 'react';
33
import NiceModal, { useModal, antdModalV5 } from '@ebay/nice-modal-react';
44

55
const MyModal1 = NiceModal.create(({ p1, p2 }: { p1: string; p2: number }) => {
@@ -22,16 +22,20 @@ const MyModal2 = NiceModal.create(() => {
2222
);
2323
});
2424

25-
NiceModal.register('modal-1', MyModal1, { p2: 1 });
25+
NiceModal.register('modal-1', MyModal1, { p2: 1, p1: 'abc' });
2626

2727
export default function TsTest() {
28-
const modal1 = useModal(MyModal1, { p3: 'foo', p2: 123 });
28+
const modal1 = useModal(MyModal1, { p1: 'abc', p2: 123 });
2929
modal1.show({ p1: 'foo', p2: 123, p4: 'hello' }); // expected: p4 should not be accepted
30+
modal1.show({ p2: 1, p1: '1' });
31+
modal1.show({ p2: 1, p1: 1 }); // expected: p1 should be string
32+
modal1.show();
3033

3134
NiceModal.show(MyModal1); // valid?
3235
NiceModal.show(MyModal1, { p1: 'foo', p2: 123 }); // valid
3336
NiceModal.show(MyModal1, { p1: 'foo', p2: '123' }); // expected ts error: p2 should be number
34-
NiceModal.show(MyModal1, { p1: 'foo' }); // unexpected ts error: p2 is already set when register
37+
NiceModal.show(MyModal1, { p1: 'foo' });
38+
NiceModal.show(MyModal1, { p2: 123 });
3539

3640
const modal1_1 = useModal('modal-1', { p3: 'foo', p2: 123 });
3741
modal1_1.show();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ebay/nice-modal-react",
3-
"version": "1.2.10",
3+
"version": "1.2.11",
44
"license": "MIT",
55
"main": "./lib/cjs/index.js",
66
"module": "./lib/esm/index.js",

0 commit comments

Comments
 (0)