mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add textversionjs
Update textversionjs Add test Add tsconfig Add tslint Update textversionjs Fixed linting errors
This commit is contained in:
parent
4663cef676
commit
1c8d97fc7a
29
types/textversionjs/index.d.ts
vendored
Normal file
29
types/textversionjs/index.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Type definitions for textversionjs 1.1
|
||||
// Project: https://github.com/EDMdesigner/textversionjs
|
||||
// Definitions by: Aaron Osher <https://github.com/aaronosher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
import * as textVersion from "textversionjs";
|
||||
=============================================== */
|
||||
|
||||
declare function textversionjs(html: string, styleConfig?: textversionjs.styleConfig): string;
|
||||
|
||||
declare namespace textversionjs {
|
||||
type linkProcess = (href: string, linkText: string) => string;
|
||||
|
||||
type imgProcess = (src: string, alt: string) => string;
|
||||
|
||||
interface styleConfig {
|
||||
linkProcess?: linkProcess;
|
||||
imgProcess?: imgProcess;
|
||||
headingStyle?: 'underline' | 'linebreak' | 'hashify';
|
||||
listStyle?: 'indentation' | 'linebreak';
|
||||
uIndentionChar?: string;
|
||||
oIndentionChar?: string;
|
||||
listIndentionTabs?: number;
|
||||
keepNbsps?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = textversionjs;
|
||||
13
types/textversionjs/textversionjs-tests.ts
Normal file
13
types/textversionjs/textversionjs-tests.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import textVersion = require('textversionjs');
|
||||
|
||||
// $ExpectType string
|
||||
textVersion("<h1>Hello World</h1><p>Hello World</p>");
|
||||
/*
|
||||
=>
|
||||
Hello World
|
||||
===========
|
||||
Hello World
|
||||
*/
|
||||
|
||||
// $ExpectError
|
||||
textVersion(1);
|
||||
23
types/textversionjs/tsconfig.json
Normal file
23
types/textversionjs/tsconfig.json
Normal 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",
|
||||
"textversionjs-tests.ts"
|
||||
]
|
||||
}
|
||||
8
types/textversionjs/tslint.json
Normal file
8
types/textversionjs/tslint.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"indent": [true, "spaces", 4],
|
||||
"max-line-length": [true, 100],
|
||||
"no-any": true
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user