Add types/tests for deindent (#36549)

This commit is contained in:
Avi Vahl
2019-07-01 21:17:31 +03:00
committed by Ryan Cavanaugh
parent 891dfd1e9d
commit aa253dc91e
4 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import deindent = require('deindent');
// as a string function
deindent(`
this
is
the ${'end'}
my only
friend
the end
`);
// as a template tag
deindent`
this
is
the ${'end'}
my only
friend
the end
`;
// as a higher-order template tag
deindent(String.raw)`
this
is
the ${'end'}
my only
friend
the end
`;

12
types/deindent/index.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// Type definitions for deindent 0.1
// Project: https://github.com/deanlandolt/deindent
// Definitions by: Avi Vahl <https://github.com/AviVahl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function deindent(
tagFn: (template: TemplateStringsArray, ...substitutions: any[]) => string
): (template: TemplateStringsArray, ...substitutions: any[]) => string;
declare function deindent(template: TemplateStringsArray, ...substitutions: any[]): string;
declare function deindent(input: string): string;
export = deindent;

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",
"deindent-tests.ts"
]
}

View File

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