forked from staylor/react-helmet-async
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copies react-helmet types across so incorrect types can be removed
rewind etc are not valid for this library, forking the react-helmet types into this project fixes staylor#61
- Loading branch information
1 parent
e02564f
commit 04245e6
Showing
1 changed file
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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,15 +1,86 @@ | ||
declare module 'react-helmet-async' { | ||
import * as React from 'react'; | ||
import { Helmet, HelmetData } from 'react-helmet'; | ||
export { Helmet }; | ||
|
||
export type FilledContext = { | ||
interface OtherElementAttributes { | ||
[key: string]: string | number | boolean | null | undefined; | ||
} | ||
|
||
type HtmlProps = JSX.IntrinsicElements['html'] & OtherElementAttributes; | ||
|
||
type BodyProps = JSX.IntrinsicElements['body'] & OtherElementAttributes; | ||
|
||
type LinkProps = JSX.IntrinsicElements['link']; | ||
|
||
type MetaProps = JSX.IntrinsicElements['meta']; | ||
|
||
export interface HelmetTags { | ||
baseTag: Array<any>; | ||
linkTags: Array<HTMLLinkElement>; | ||
metaTags: Array<HTMLMetaElement>; | ||
noscriptTags: Array<any>; | ||
scriptTags: Array<HTMLScriptElement>; | ||
styleTags: Array<HTMLStyleElement>; | ||
} | ||
|
||
export interface HelmetProps { | ||
async?: boolean; | ||
base?: any; | ||
bodyAttributes?: BodyProps; | ||
defaultTitle?: string; | ||
defer?: boolean; | ||
encodeSpecialCharacters?: boolean; | ||
htmlAttributes?: HtmlProps; | ||
onChangeClientState?: (newState: any, addedTags: HelmetTags, removedTags: HelmetTags) => void; | ||
link?: LinkProps[]; | ||
meta?: MetaProps[]; | ||
noscript?: Array<any>; | ||
script?: Array<any>; | ||
style?: Array<any>; | ||
title?: string; | ||
titleAttributes?: Object; | ||
titleTemplate?: string; | ||
} | ||
|
||
export class Helmet extends React.Component<HelmetProps> { | ||
} | ||
|
||
export interface HelmetData { | ||
base: HelmetDatum; | ||
bodyAttributes: HelmetHTMLBodyDatum; | ||
htmlAttributes: HelmetHTMLElementDatum; | ||
link: HelmetDatum; | ||
meta: HelmetDatum; | ||
noscript: HelmetDatum; | ||
script: HelmetDatum; | ||
style: HelmetDatum; | ||
title: HelmetDatum; | ||
titleAttributes: HelmetDatum; | ||
} | ||
|
||
export interface HelmetDatum { | ||
toString(): string; | ||
toComponent(): React.Component<any>; | ||
} | ||
|
||
export interface HelmetHTMLBodyDatum { | ||
toString(): string; | ||
toComponent(): React.HTMLAttributes<HTMLBodyElement>; | ||
} | ||
|
||
export interface HelmetHTMLElementDatum { | ||
toString(): string; | ||
toComponent(): React.HTMLAttributes<HTMLHtmlElement>; | ||
} | ||
|
||
export interface FilledContext { | ||
helmet: HelmetData; | ||
}; | ||
|
||
type ProviderProps = { | ||
interface ProviderProps { | ||
context?: {}; | ||
}; | ||
|
||
export const HelmetProvider: React.ComponentClass<ProviderProps>; | ||
export class HelmetProvider extends React.Component<ProviderProps> { | ||
static canUseDOM = canUseDOM; | ||
} | ||
} |