From 32f9a46f6b84ee86dfb14ebdd77fddf7cfa85a37 Mon Sep 17 00:00:00 2001 From: Mark Langovoi Date: Wed, 18 Sep 2024 09:44:45 +0700 Subject: [PATCH] fix Asset type --- docs/api/manifest.md | 13 ++++++++++++- packages/vinxi/types/manifest.d.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/api/manifest.md b/docs/api/manifest.md index da00e4ca..0bf29fe9 100644 --- a/docs/api/manifest.md +++ b/docs/api/manifest.md @@ -12,7 +12,18 @@ The manifest API is also the same between the server and client, development and You can access the manifest for any router by using calling `getManifest(routerName)` (exported by `vinxi/manifest`). This will give you a manifest object that looks like this: ```ts -export type Asset = string; +export type Asset = LinkAsset | ScriptOrStyleAsset; + +type LinkAsset = { + tag: 'link'; + attrs: Record +} + +type ScriptOrStyleAsset = { + tag: 'script' | 'style'; + attrs: Record; + children?: string; +} export type Manifest = { /** Name of the router */ diff --git a/packages/vinxi/types/manifest.d.ts b/packages/vinxi/types/manifest.d.ts index bdcac535..ca995d67 100644 --- a/packages/vinxi/types/manifest.d.ts +++ b/packages/vinxi/types/manifest.d.ts @@ -1,4 +1,15 @@ -export type Asset = string; +export type Asset = LinkAsset | ScriptOrStyleAsset; + +type LinkAsset = { + tag: 'link'; + attrs: Record +} + +type ScriptOrStyleAsset = { + tag: 'script' | 'style'; + attrs: Record; + children?: string; +} export type Manifest = { /** Name of the router */