feat(docdown): new type definition (#46020)

Definition types for 'docdown':
- definitioins files
- tests

https://github.com/jdalton/docdown#readme

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-07-12 10:06:42 +02:00 committed by GitHub
parent 0bfb40fb47
commit e8378bbd71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import docdown = require('docdown');
import { Options } from 'docdown';
const options: Options = {
path: './some/path',
url: 'https://github.com/username/project/blob/master/my.js',
};
const markdown = docdown(options);
// $ExpectType string
docdown({
path: './some/path',
url: 'https://example.com/my.js',
lang: 'js',
sort: false,
style: 'github',
title: 'README',
toc: 'properties',
});

50
types/docdown/index.d.ts vendored Normal file
View File

@ -0,0 +1,50 @@
// Type definitions for docdown 0.7
// Project: https://github.com/jdalton/docdown#readme
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* A simple JSDoc to Markdown documentation generator.
* Generates Markdown documentation based on JSDoc comments.
*/
declare function docdown(options: docdown.Options): string;
declare namespace docdown {
interface Options {
/**
* the input file pat
*/
path: string;
/**
* The source URL.
*/
url: string;
/**
* The language indicator for code blocks.
* @default 'js'
*/
lang?: string;
/**
* Specify whether entries are sorted.
* @default true
*/
sort?: boolean;
/**
* The hash style for links ('default' or 'github').
* @default 'default'
*/
style?: string;
/**
* The documentation title.
* @default '<%= basename(options.path) %> API documentation'
*/
title?: string;
/**
* The table of contents organization style ('categories' or 'properties').
* @default 'properties'
*/
toc?: string;
}
}
export = docdown;

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

View File

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