mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[react-frame-component] Introduce type definitions (#38750)
This commit is contained in:
parent
8501cb5b3e
commit
2ea517f1b6
27
types/react-frame-component/index.d.ts
vendored
Normal file
27
types/react-frame-component/index.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Type definitions for react-frame-component 4.1
|
||||
// Project: https://github.com/ryanseddon/react-frame-component
|
||||
// Definitions by: Alex Bukurov <https://github.com/abukurov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export interface FrameComponentProps extends React.IframeHTMLAttributes<HTMLIFrameElement> {
|
||||
head?: React.ReactNode;
|
||||
mountTarget?: string;
|
||||
initialContent?: string;
|
||||
contentDidMount?: () => void;
|
||||
contentDidUpdate?: () => void;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default class FrameComponent extends React.Component<FrameComponentProps> {}
|
||||
|
||||
export interface FrameContext {
|
||||
document?: any;
|
||||
window?: any;
|
||||
}
|
||||
|
||||
export const FrameContextProvider: React.Provider<FrameContext>;
|
||||
|
||||
export const FrameContextConsumer: React.Consumer<FrameContext>;
|
||||
22
types/react-frame-component/react-frame-component-tests.tsx
Normal file
22
types/react-frame-component/react-frame-component-tests.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import Frame, { FrameContextConsumer } from 'react-frame-component';
|
||||
|
||||
<div>
|
||||
<Frame>
|
||||
<span>content</span>
|
||||
</Frame>
|
||||
<Frame
|
||||
head={<span>head</span>}
|
||||
mountTarget='#mountHere'
|
||||
contentDidMount={() => {}}
|
||||
contentDidUpdate={() => {}}
|
||||
initialContent='<!DOCTYPE html><html><head></head><body><h1>i wont be changed</h1><div id="mountHere"></div></body></html>'
|
||||
>
|
||||
<span>content</span>
|
||||
</Frame>
|
||||
<Frame>
|
||||
<FrameContextConsumer>
|
||||
{({ document, window }) => <span>content</span>}
|
||||
</FrameContextConsumer>
|
||||
</Frame>
|
||||
</div>;
|
||||
25
types/react-frame-component/tsconfig.json
Normal file
25
types/react-frame-component/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"jsx": "react",
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-frame-component-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-frame-component/tslint.json
Normal file
1
types/react-frame-component/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user