mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
add type definition for idyll-document (#25455)
This commit is contained in:
parent
b7759e6aab
commit
b1086b6614
5
types/idyll-document/idyll-document-tests.ts
Normal file
5
types/idyll-document/idyll-document-tests.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import IdyllDocument, { IdyllDocumentProps } from "idyll-document";
|
||||
import { createElement } from "react";
|
||||
|
||||
// $ExpectType ReactElement<IdyllDocumentProps>
|
||||
createElement<IdyllDocumentProps>(IdyllDocument);
|
||||
62
types/idyll-document/index.d.ts
vendored
Normal file
62
types/idyll-document/index.d.ts
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
// Type definitions for idyll-document 2.9
|
||||
// Project: https://github.com/idyll-lang/idyll/tree/master/packages/idyll-document
|
||||
// Definitions by: Thanh Ngo <https://github.com/iocat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { PureComponent, ReactType } from "react";
|
||||
import { Options as CompilerOptions, AST } from "idyll-compiler";
|
||||
|
||||
export interface IdyllDocumentProps {
|
||||
/**
|
||||
* Components to be rendered with
|
||||
*/
|
||||
components: any;
|
||||
/**
|
||||
* the AST to be rendered on the page
|
||||
* If provided, this will be used insteaed of
|
||||
* the markup
|
||||
*/
|
||||
ast?: AST;
|
||||
/**
|
||||
* The Idyll markup to be compiled into AST
|
||||
*/
|
||||
markup?: string;
|
||||
/**
|
||||
* Initial data set
|
||||
*/
|
||||
datasets?: object;
|
||||
|
||||
/**
|
||||
* The theme for idyll document
|
||||
* Will correspond to one theme in idyll-theme package
|
||||
*/
|
||||
theme?: string;
|
||||
/**
|
||||
* The layout for idyll document
|
||||
* Will correspond to one one layout in idyll-layouts package
|
||||
*/
|
||||
layout?: string;
|
||||
/**
|
||||
* Callback function if error happens during compilation
|
||||
*/
|
||||
onError?: (err: Error) => void;
|
||||
/**
|
||||
* The React component rendered when an error occurs
|
||||
*/
|
||||
errorComponent?: ReactType<{
|
||||
className?: string;
|
||||
children: Error["message"] | null;
|
||||
}>;
|
||||
/**
|
||||
* Compiler option for Idyll compiler when compiling markup
|
||||
*/
|
||||
compilerOptions?: CompilerOptions;
|
||||
|
||||
context?: (context: any) => void;
|
||||
initialState?: any;
|
||||
}
|
||||
|
||||
declare class IdyllDocument extends PureComponent<IdyllDocumentProps, any> {}
|
||||
|
||||
export default IdyllDocument;
|
||||
16
types/idyll-document/tsconfig.json
Normal file
16
types/idyll-document/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": ["index.d.ts", "idyll-document-tests.ts"]
|
||||
}
|
||||
3
types/idyll-document/tslint.json
Normal file
3
types/idyll-document/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user