Merge pull request #31170 from BendingBender/escape-goat

Add types for escape-goat
This commit is contained in:
Andrew Casey
2018-12-07 15:29:41 -08:00
committed by GitHub
4 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import * as escapeGoat from 'escape-goat';
// $ExpectType string
escapeGoat.escape('🦄 & 🐐');
// $ExpectType string
escapeGoat.unescape('🦄 & 🐐');
// $ExpectType string
escapeGoat.escape('Hello <em>World</em>');
const url = 'https://sindresorhus.com?x="🦄"';
// $ExpectType string
escapeGoat.escapeTag`<a href="${url}">Unicorn</a>`;

9
types/escape-goat/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for escape-goat 1.3
// Project: https://github.com/sindresorhus/escape-goat#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function escape(input: string): string;
export function unescape(input: string): string;
export function escapeTag(template: TemplateStringsArray, ...substitutions: any[]): string;
export function unescapeTag(template: TemplateStringsArray, ...substitutions: any[]): string;

View File

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

View File

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