JonathanXDR / Application-Website-Frontend

My Personal Website
https://jonathan-russ.com
MIT License
1 stars 2 forks source link

Fix types #28

Closed JonathanXDR closed 3 months ago

JonathanXDR commented 7 months ago

Currently, there are multiple type errors when trying to build the application. Take a look at the errors from the build log attached and either fix them by either updating the types directly or altering their usage in throughout the application properly, so the build succeeds. One of the most critical errors is the one where Omit<SizeType, 'xsmall' & 'xlarge'> is used as we only want to have small, medium or large sizes for those components, however it somehow results in an error.

[Build Log]:

Nuxt 3.11.2 with Nitro 2.9.6
[nuxt:tailwindcss] ℹ Using Tailwind CSS from ~/assets/css/tailwind.css
ℹ Building client...
ℹ vite v5.2.11 building for production...
ℹ transforming...

 WARN 
/img/lines.jpg referenced in /Users/jonathan/Developer/Git/GitHub/Application-Website-Frontend/pages/index.vue?vue&type=style&index=0&scoped=9227a074&lang.css didn't resolve at build time, it will remain unchanged to be resolved at runtime

 WARN 
/img/vignette.png referenced in /Users/jonathan/Developer/Git/GitHub/Application-Website-Frontend/pages/index.vue?vue&type=style&index=0&scoped=9227a074&lang.css didn't resolve at build time, it will remain unchanged to be resolved at runtime

ℹ ✓ 199 modules transformed.

 ERROR  x Build failed in 1.13s

 ERROR  Nuxt Build Error: [vite:vue] [@vue/compiler-sfc] Failed to resolve element type from target type

/Users/jonathan/Developer/Git/GitHub/Application-Website-Frontend/types/services/GitHub/Repository.ts
11 |  
12 |  export type GetUserRepository =
13 |    Endpoints['GET /users/{username}/repos']['response']['data'][number]
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 |  
15 |  export type GetOwnerRepository =
file: /Users/jonathan/Developer/Git/GitHub/Application-Website-Frontend/components/common/CardItem.client.vue

  types/services/GitHub/Repository.ts
  11 |
  12 |  export type GetUserRepository =
  13 |    Endpoints['GET /users/{username}/repos']['response']['data'][number]
  |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  14 |
  15 |  export type GetOwnerRepository =
  file: components/common/CardItem.client.vue
  at ScriptCompileContext.error (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:15706:11)
  at resolveArrayElementType (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18249:14)
  at resolveIndexType (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18208:12)
  at innerResolveTypeElements (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17973:21)
  at resolveTypeElements (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17938:20)
  at innerResolveTypeElements (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18005:16)
  at resolveTypeElements (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17938:20)
  at resolveBuiltin (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18333:13)
  at innerResolveTypeElements (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:18025:20)
  at resolveTypeElements (node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:17938:20)

error: script "build" exited with code 1
components/common/Badge.vue(31,3): error TS2322: Type '"medium"' is not assignable to type 'InferDefault<LooseRequired<BadgeType>, SizeType | undefined> | undefined'.
components/common/ButtonItem.vue(23,5): error TS2322: Type 'string' is not assignable to type '(props: LooseRequired<{ as?: keyof HTMLElementTagNameMap | undefined; variant?: "primary" | "secondary" | "tertiary" | undefined; size?: Omit<SizeType, never> | undefined; borderRadius?: "reduced" | ... 1 more ... | undefined; label: string; icon?: IconType | undefined; }>) => Omit<...>'.
components/common/CardItem.client.vue(126,3): error TS2322: Type 'string' is not assignable to type 'InferDefault<LooseRequired<Props>, (Omit<SizeType, never> & number) | undefined> | undefined'.
components/common/CardItem.client.vue(132,5): error TS2353: Object literal may only specify known properties, and 'donut' does not exist in type '(props: LooseRequired<Props>) => { donut?: boolean | undefined; bar?: boolean | undefined; }'.
components/common/CardItem.client.vue(136,5): error TS2353: Object literal may only specify known properties, and 'formatOptions' does not exist in type '(props: LooseRequired<Props>) => { formatOptions: DateTimeFormatOptions; nowKey?: "created" | "updated" | undefined; }'.
components/common/CardItem.client.vue(144,5): error TS2353: Object literal may only specify known properties, and 'absolute' does not exist in type '(props: LooseRequired<Props>) => IconType'.
components/common/CardItem.client.vue(183,43): error TS2339: Property 'tags' does not exist on type 'PropsWithDefaults<LooseRequired<Props>, InferDefaults<LooseRequired<Props>>, "loading" | "private" | "fork" | "is_template" | ... 10 more ... | "web_commit_signoff_required">'.
components/common/CardItem.client.vue(211,26): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'PropsWithDefaults<LooseRequired<Props>, InferDefaults<LooseRequired<Props>>, "loading" | "private" | "fork" | "is_template" | ... 10 more ... | "web_commit_signoff_required">'.
  No index signature with a parameter of type 'string' was found on type 'PropsWithDefaults<LooseRequired<Props>, InferDefaults<LooseRequired<Props>>, "loading" | "private" | "fork" | "is_template" | ... 10 more ... | "web_commit_signoff_required">'.
components/common/CardItem.client.vue(236,7): error TS2538: Type 'undefined' cannot be used as an index type.
components/common/CardItem.client.vue(255,48): error TS2367: This comparison appears to be unintentional because the types 'Omit<SizeType, never> & number' and 'string' have no overlap.
components/common/CardItem.client.vue(256,47): error TS2345: Argument of type 'Omit<SizeType, never> & number' is not assignable to parameter of type 'string'.
components/common/CardItem.client.vue(257,47): error TS2367: This comparison appears to be unintentional because the types 'Omit<SizeType, never> & number' and 'string' have no overlap.
components/common/Icon.vue(14,3): error TS2322: Type 'string' is not assignable to type '(props: LooseRequired<IconType>) => Omit<SizeType, never>'.
components/common/LanguagePickerDropdown.client.vue(34,5): error TS2322: Type 'string' is not assignable to type '(props: LooseRequired<{ size?: Omit<SizeType, "xlarge"> | undefined; }>) => Omit<SizeType, "xlarge">'.
components/common/LanguagePickerDropdown.client.vue(56,16): error TS2538: Type 'Omit<SizeType, "xlarge">' cannot be used as an index type.
components/common/SegmentNav.client.vue(84,5): error TS2322: Type 'string' is not assignable to type '(props: LooseRequired<{ items: ItemType[]; size?: Omit<SizeType, "xlarge"> | undefined; label?: "icon" | "text" | "combination" | undefined; focus?: boolean | undefined; ... 7 more ...; onSelect?: ((id: string) => void) | undefined; }>) => Omit<...>'.
components/common/SegmentNav.client.vue(139,16): error TS2538: Type 'Omit<SizeType, "xlarge">' cannot be used as an index type.
components/common/SegmentNav.client.vue(149,16): error TS2538: Type 'Omit<SizeType, "xlarge">' cannot be used as an index type.
components/containers/AboutSection.vue(29,7): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
components/containers/OtherSection.vue(10,7): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
components/containers/OtherSection.vue(12,9): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.
components/containers/ProjectsSection.vue(33,11): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
components/containers/ProjectsSection.vue(36,11): error TS2741: Property 'name' is missing in type '{ position: "top" | "left"; }' but required in type 'IconType'.
components/containers/ProjectsSection.vue(58,13): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
components/containers/ProjectsSection.vue(74,13): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
components/containers/ReferencesSection.vue(9,7): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
components/containers/ReferencesSection.vue(11,7): error TS2741: Property 'name' is missing in type '{ position: "top" | "left"; }' but required in type 'IconType'.
components/containers/TechnologiesSection.vue(19,9): error TS2322: Type 'string' is not assignable to type 'Omit<SizeType, never> & number'.
layouts/default.vue(5,6): error TS2345: Argument of type '{ loading: false; }' is not assignable to parameter of type 'Partial<{ loading: boolean; }> & Omit<{ readonly description: string; readonly loading: boolean; readonly links: LinkType[]; } & VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly<...>, "loading"> & Record<...>'.
  Type '{ loading: false; }' is missing the following properties from type 'Omit<{ readonly description: string; readonly loading: boolean; readonly links: LinkType[]; } & VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly<...>, "loading">': description, links