Bruno Predot

typage des props.

@@ -10,14 +10,6 @@ import { FilmIcon } from "lucide-vue-next"; @@ -10,14 +10,6 @@ import { FilmIcon } from "lucide-vue-next";
10 defineProps<{ 10 defineProps<{
11 movie: MovieInterface; 11 movie: MovieInterface;
12 }>(); 12 }>();
13 -/** Ancien typage */  
14 -// defineProps({  
15 -// movie: {  
16 -// type: Object,  
17 -// required: true,  
18 -// nullable: false,  
19 -// },  
20 -// });  
21 // #endregion 13 // #endregion
22 </script> 14 </script>
23 15
@@ -9,14 +9,6 @@ import { MessageSquareIcon } from "lucide-vue-next"; @@ -9,14 +9,6 @@ import { MessageSquareIcon } from "lucide-vue-next";
9 const props = defineProps<{ 9 const props = defineProps<{
10 comments: Array<MovieCommentInterface>; 10 comments: Array<MovieCommentInterface>;
11 }>(); 11 }>();
12 -/** Ancien typage */  
13 -// const props = defineProps({  
14 -// comments: {  
15 -// type: Array<MovieCommentInterface>,  
16 -// required: true,  
17 -// nullable: false,  
18 -// },  
19 -// });  
20 // #endregion 12 // #endregion
21 13
22 // #region --Watch--. 14 // #region --Watch--.
@@ -4,13 +4,9 @@ import type { Genre } from "~/interfaces/movie"; @@ -4,13 +4,9 @@ import type { Genre } from "~/interfaces/movie";
4 // #endregion 4 // #endregion
5 5
6 // #region --Props--. 6 // #region --Props--.
7 -defineProps({ 7 +defineProps<{
8 - genres: { 8 + genres: Array<Genre>;
9 - type: Array<Genre>, 9 +}>();
10 - required: true,  
11 - nullable: false,  
12 - },  
13 -});  
14 // #endregion 10 // #endregion
15 </script> 11 </script>
16 12
@@ -5,19 +5,6 @@ defineProps<{ @@ -5,19 +5,6 @@ defineProps<{
5 score: number; 5 score: number;
6 nbVote: number; 6 nbVote: number;
7 }>(); 7 }>();
8 -/** Ancien typage */  
9 -// defineProps({  
10 -// score: {  
11 -// type: Number,  
12 -// required: true,  
13 -// nullable: false,  
14 -// },  
15 -// nbVote: {  
16 -// type: Number,  
17 -// required: true,  
18 -// nullable: false,  
19 -// },  
20 -// });  
21 // #endregion 8 // #endregion
22 9
23 // #region --Function--. 10 // #region --Function--.
@@ -6,13 +6,10 @@ import { helpers, maxLength, maxValue, minLength, minValue, required } from "@vu @@ -6,13 +6,10 @@ import { helpers, maxLength, maxValue, minLength, minValue, required } from "@vu
6 // #endregion 6 // #endregion
7 7
8 // #region --Props--. 8 // #region --Props--.
9 -defineProps({ 9 +withDefaults(defineProps<{
10 - isSubmitting: { 10 + isSubmitting?: boolean;
11 - type: Boolean, 11 +}>(), {
12 - required: false, 12 + isSubmitting: false,
13 - nullable: false,  
14 - default: false,  
15 - },  
16 }); 13 });
17 // #endregion 14 // #endregion
18 15
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 // #region --Props--. 2 // #region --Props--.
3 -defineProps({ 3 +defineProps<{
4 - src: { 4 + src: string;
5 - type: String, 5 + title: string;
6 - required: true, 6 +}>();
7 - nullable: false,  
8 - },  
9 - title: {  
10 - type: String,  
11 - required: true,  
12 - nullable: false,  
13 - },  
14 -});  
15 // #endregion 7 // #endregion
16 8
17 // #region --Declaration--. 9 // #region --Declaration--.
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 // #region --Props--. 2 // #region --Props--.
3 -defineProps({ 3 +withDefaults(defineProps<{
4 - isLoading: { 4 + isLoading: boolean;
5 - type: Boolean, 5 + isInitialLoading?: boolean;
6 - required: true, 6 +}>(), {
7 - nullable: false, 7 + isInitialLoading: false,
8 - },  
9 - isInitialLoading: {  
10 - type: Boolean,  
11 - required: false,  
12 - nullable: false,  
13 - default: false,  
14 - },  
15 }); 8 });
16 // #endregion 9 // #endregion
17 </script> 10 </script>
@@ -2,18 +2,10 @@ @@ -2,18 +2,10 @@
2 // #region --Props--. 2 // #region --Props--.
3 import { FilmIcon } from "lucide-vue-next"; 3 import { FilmIcon } from "lucide-vue-next";
4 4
5 -defineProps({ 5 +defineProps<{
6 - src: { 6 + src: string;
7 - type: String, 7 + title: string;
8 - required: true, 8 +}>();
9 - nullable: false,  
10 - },  
11 - title: {  
12 - type: String,  
13 - required: true,  
14 - nullable: false,  
15 - },  
16 -});  
17 // #endregion 9 // #endregion
18 </script> 10 </script>
19 11
@@ -6,13 +6,10 @@ import { ref } from "vue"; @@ -6,13 +6,10 @@ import { ref } from "vue";
6 // #endregion 6 // #endregion
7 7
8 // #region --Props--. 8 // #region --Props--.
9 -defineProps({ 9 +withDefaults(defineProps<{
10 - placeholder: { 10 + placeholder?: string;
11 - type: String, 11 +}>(), {
12 - required: false, 12 + placeholder: "",
13 - nullable: false,  
14 - default: "",  
15 - },  
16 }); 13 });
17 // #endregion 14 // #endregion
18 15
1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 // #region --Props--. 2 // #region --Props--.
3 -defineProps({ 3 +withDefaults(defineProps<{
4 - isInitialLoading: { 4 + isInitialLoading: boolean;
5 - type: Boolean, 5 + skeletonNumber?: number;
6 - required: true, 6 +}>(), {
7 - nullable: false, 7 + skeletonNumber: 12,
8 - },  
9 - skeletonNumber: {  
10 - type: Number,  
11 - required: false,  
12 - nullable: false,  
13 - default: 12,  
14 - },  
15 }); 8 });
16 // #endregion 9 // #endregion
17 </script> 10 </script>