🤖 Merge PR #61418 Add types for 'css.escape' v1.5 by @mihnea-s

This commit is contained in:
mihnea-s
2022-07-25 22:58:28 +03:00
committed by GitHub
parent aa746eb8ba
commit f84d22c775
4 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import cssEscape = require('css.escape');
// $ExpectType string
cssEscape('--string');
// @ts-expect-error
cssEscape({});
// $ExpectType string
CSS.escape('');
// @ts-expect-error
CSS.escape({});

16
types/css.escape/index.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
// Type definitions for css.escape 1.5
// Project: https://github.com/mathiasbynens/CSS.escape
// Definitions by: Mihnea Stoian <https://github.com/mihnea-s>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare global {
const CSS: {
/**
* A robust polyfill for the `CSS.escape` utility method as defined in
* [CSSOM](https://drafts.csswg.org/cssom/#the-css.escape()-method).
*/
escape(css: string): string;
};
}
export = CSS.escape;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"css.escape-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "@definitelytyped/dtslint/dt.json" }