Skip to content

Commit

Permalink
fix: improve default values for useMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed May 10, 2020
1 parent eded53e commit f3024e1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/meta.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { MetaInfo } from 'vue-meta'

type MetaInfoMapper<T> = {
[P in keyof T]: T[P] extends Array<any> ? T[P] : T[P] | undefined
[P in keyof T]: P extends 'base'
? T[P] | undefined
: T[P] extends Function
? T[P] | undefined
: T[P] extends Array<any> | Record<string, any>
? T[P]
: T[P] | undefined
}

export function createEmptyMeta(): MetaInfoMapper<Required<MetaInfo>> {
return {
__dangerouslyDisableSanitizers: [],
__dangerouslyDisableSanitizersByTagID: undefined,
__dangerouslyDisableSanitizersByTagID: {},

title: undefined,
titleTemplate: undefined,
htmlAttrs: undefined,
headAttrs: undefined,
bodyAttrs: undefined,
htmlAttrs: {},
headAttrs: {},
bodyAttrs: {},

base: undefined,

Expand Down

0 comments on commit f3024e1

Please sign in to comment.