Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed Oct 4, 2023
1 parent a302ff0 commit 643f265
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,28 @@ To generate the route types, run Ziggy's Artisan command with the `--types` or `
php artisan ziggy:generate --types
```

To make your IDE aware that Ziggy's `route()` helper is available globally, and to type it correctly, add a declaration like this in a `.d.ts` file somewhere in your project:

```ts
import routeFn from 'ziggy-js';

declare global {
var route: typeof routeFn;
}
```

If you don't have Ziggy's NPM package installed, add the following to your `jsconfig.json` or `tsconfig.json` to load Ziggy's types from the Composer vendor directory:

```json
{
"compilerOptions": {
"paths": {
"ziggy-js": ["./vendor/tightenco/ziggy"]
}
}
}
```

## Advanced Setup

#### JavaScript frameworks
Expand Down

0 comments on commit 643f265

Please sign in to comment.