mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
preact-custom-elements types (#47779)
* preact-custom-elements types * Tabs to Spaces * test case for function call register from package preact-custom-element * typing to export equals convention * Tests adjusted to naming convention * commonjs syntax for backwards compatibility Co-authored-by: Kasper <kasper@sitepark.com>
This commit is contained in:
parent
a349594bae
commit
21abd0b325
15
types/preact-custom-element/index.d.ts
vendored
Normal file
15
types/preact-custom-element/index.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Type definitions for preact-custom-element 4.0
|
||||
// Project: https://github.com/preactjs/preact-custom-element#readme
|
||||
// Definitions by: Nicolai Kasper <https://github.com/paull39>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.9
|
||||
|
||||
import { ComponentClass, FunctionComponent, FunctionalComponent } from 'preact';
|
||||
declare function register(
|
||||
componentDefinition: FunctionComponent<any> | ComponentClass<any> | FunctionalComponent<any>,
|
||||
tagName: string,
|
||||
observedAttributes?: string[],
|
||||
options?: { shadow: boolean },
|
||||
): void;
|
||||
|
||||
export = register;
|
||||
6
types/preact-custom-element/package.json
Normal file
6
types/preact-custom-element/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"preact": "^10.0.0"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import { h, render, Component, FunctionalComponent } from 'preact';
|
||||
import register = require('preact-custom-element');
|
||||
|
||||
const Foo: FunctionalComponent<any> = props => {
|
||||
return <div></div>;
|
||||
};
|
||||
|
||||
register(Foo, 'my-foo');
|
||||
27
types/preact-custom-element/tsconfig.json
Normal file
27
types/preact-custom-element/tsconfig.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"jsx": "react",
|
||||
"jsxFactory": "h",
|
||||
"experimentalDecorators": true,
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"preact-custom-element-tests.tsx"
|
||||
]
|
||||
}
|
||||
3
types/preact-custom-element/tslint.json
Normal file
3
types/preact-custom-element/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user