mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add type definitions for insert-css (#31263)
* Add type definitions for insert-css * Correct indentation in insert-css-tests.ts * Make createElement calls consistent * Use single quotes in import
This commit is contained in:
parent
5b5759e17b
commit
1935ac55bc
18
types/insert-css/index.d.ts
vendored
Normal file
18
types/insert-css/index.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Type definitions for insert-css 2.0
|
||||
// Project: https://github.com/substack/insert-css
|
||||
// Definitions by: Heye Vöcking <https://github.com/hvoecking>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface InsertCssOptions {
|
||||
container?: HTMLElement;
|
||||
prepend?: boolean;
|
||||
}
|
||||
|
||||
export interface InsertCssStyleElement extends HTMLStyleElement {
|
||||
styleSheet?: CSSStyleSheet;
|
||||
}
|
||||
|
||||
export function insertCss(
|
||||
css: string,
|
||||
options?: InsertCssOptions,
|
||||
): InsertCssStyleElement;
|
||||
27
types/insert-css/insert-css-tests.ts
Normal file
27
types/insert-css/insert-css-tests.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { insertCss } from 'insert-css';
|
||||
|
||||
insertCss('body{position:absolute}');
|
||||
|
||||
insertCss('body{position:absolute}', {});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: true,
|
||||
});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: false,
|
||||
});
|
||||
|
||||
insertCss('body{position:absolute}', {
|
||||
container: document.createElement(''),
|
||||
});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: true,
|
||||
container: document.createElement(''),
|
||||
});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: false,
|
||||
container: document.createElement(''),
|
||||
});
|
||||
26
types/insert-css/tsconfig.json
Normal file
26
types/insert-css/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"strictNullChecks": true,
|
||||
"typeRoots": ["../"],
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"insert-css-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/insert-css/tslint.json
Normal file
1
types/insert-css/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user