Skip to content

Commit

Permalink
Add types/tests for deindent (DefinitelyTyped#36549)
Browse files Browse the repository at this point in the history
  • Loading branch information
AviVahl authored and RyanCavanaugh committed Jul 1, 2019
1 parent 891dfd1 commit aa253dc
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
31 changes: 31 additions & 0 deletions types/deindent/deindent-tests.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions types/deindent/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
23 changes: 23 additions & 0 deletions types/deindent/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
1 change: 1 addition & 0 deletions types/deindent/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

0 comments on commit aa253dc

Please sign in to comment.