-
Notifications
You must be signed in to change notification settings - Fork 132
Fix TypeScript errors in ssr.ts & when using vue-tsc #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0d354b8
Add node for SSR and remove unknown vue/tsx types
TimKunze96 512bd78
Fix ziggy related global types
TimKunze96 b1709db
Create AppPageProps
TimKunze96 127797f
Move module declaration into definition file, override PageProps and …
TimKunze96 4fc4bc2
Fix SSR type issues
TimKunze96 fcb7514
Fix various TS issues
TimKunze96 cea7a0a
Fix route params type
TimKunze96 2b9787b
Refactor global route type
TimKunze96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
import type { route as routeFn } from 'ziggy-js'; | ||
import { AppPageProps } from '@/types/index'; | ||
import { createHeadManager, Page, Router } from '@inertiajs/core'; | ||
|
||
declare global { | ||
const route: typeof routeFn; | ||
// Extend ImportMeta interface for Vite... | ||
declare module 'vite/client' { | ||
interface ImportMetaEnv { | ||
readonly VITE_APP_NAME: string; | ||
|
||
[key: string]: string | boolean | undefined; | ||
} | ||
|
||
interface ImportMeta { | ||
readonly env: ImportMetaEnv; | ||
readonly glob: <T>(pattern: string) => Record<string, () => Promise<T>>; | ||
} | ||
} | ||
|
||
// Declare shared props for Inertia and App pages... | ||
declare module '@inertiajs/core' { | ||
interface PageProps extends InertiaPageProps, AppPageProps {} | ||
} | ||
|
||
// Add typings for Inertia's $page and $headManager properties... | ||
declare module '@vue/runtime-core' { | ||
interface ComponentCustomProperties { | ||
$inertia: typeof Router; | ||
$page: Page; | ||
$headManager: ReturnType<typeof createHeadManager>; | ||
route: AppRouter; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
import { Config, RouteParams } from 'ziggy-js'; | ||
import { RouteParams, Router } from 'ziggy-js'; | ||
|
||
declare global { | ||
function route(): Config; | ||
function route(): Router; | ||
function route(name: string, params?: RouteParams<typeof name> | undefined, absolute?: boolean): string; | ||
} | ||
|
||
declare module '@vue/runtime-core' { | ||
interface ComponentCustomProperties { | ||
route: typeof route; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain to me what this is doing here?
Everything else is looking really good. Thanks for the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find any source for the
vue/tsx
types within the installed packages, nor any reference in the official Vue docs recommending setting this as a value See TS docs for Vue. I assume this value was set by mistake or might be a remnant from an outdated Vue version.The addition of the
node
types is simply there to make the compiler aware of the global object inssr.ts
.