Add types for package-info (#38235)

This commit is contained in:
Florian Keller 2019-09-24 20:28:07 +02:00 committed by Ben Lichtman
parent 8ef32e4e85
commit c8a421f842
4 changed files with 53 additions and 0 deletions

19
types/package-info/index.d.ts vendored Normal file
View File

@ -0,0 +1,19 @@
// Type definitions for package-info 3.0
// Project: https://github.com/AlessandroMinoccheri/package-info#readme
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace info {
interface Package {
author: string;
description: string;
homepage: string;
license: string;
name: string;
version: string;
}
}
declare function info(name: string): Promise<info.Package>;
export = info;

View File

@ -0,0 +1,10 @@
import info = require('package-info');
info('package-info').then(data => {
data.author; // $ExpectType string
data.description; // $ExpectType string
data.homepage; // $ExpectType string
data.license; // $ExpectType string
data.name; // $ExpectType string
data.version; // $ExpectType string
});

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

View File

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