Skip to content

Commit 5592657

Browse files
committed
Add types to common components
1 parent 998f65e commit 5592657

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

samples/vuejs/typescript/00 Custom Validator/src/common/components/form/input.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
import Vue from 'vue';
1+
import Vue, {ComponentOptions} from 'vue';
2+
3+
interface Props extends Vue {
4+
className: string;
5+
placeholder: string;
6+
type: string;
7+
value: any;
8+
inputHandler: (event) => void;
9+
label: string;
10+
name: string;
11+
}
212

313
export const InputComponent = Vue.extend({
414
props: [
@@ -27,4 +37,4 @@ export const InputComponent = Vue.extend({
2737
</div>
2838
);
2939
},
30-
});
40+
} as ComponentOptions<Props>);

samples/vuejs/typescript/00 Custom Validator/src/common/components/form/inputButton.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
import Vue from 'vue';
1+
import Vue, {ComponentOptions} from 'vue';
2+
3+
interface Props extends Vue {
4+
className: string;
5+
placeholder: string;
6+
type: string;
7+
value: any;
8+
inputHandler: (event) => void;
9+
label: string;
10+
name: string;
11+
buttonText: string;
12+
buttonClickHandler: (event) => void;
13+
buttonClassName: string;
14+
}
215

316
export const InputButtonComponent = Vue.extend({
417
props: [
@@ -40,4 +53,4 @@ export const InputButtonComponent = Vue.extend({
4053
</div>
4154
);
4255
},
43-
});
56+
} as ComponentOptions<Props>);

samples/vuejs/typescript/00 Custom Validator/src/common/components/form/validation.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import Vue from 'vue';
1+
import Vue, {ComponentOptions} from 'vue';
2+
3+
interface Props extends Vue {
4+
hasError: boolean;
5+
errorMessage: string;
6+
className: string;
7+
}
28

39
export const ValidationComponent = Vue.extend({
410
props: [
@@ -22,4 +28,4 @@ export const ValidationComponent = Vue.extend({
2228
</div>
2329
);
2430
},
25-
});
31+
} as ComponentOptions<Props>);

0 commit comments

Comments
 (0)