mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
Add type for yarnlockfile (#37144)
This commit is contained in:
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for parse-package-name 1.1
|
||||
// Project: https://github.com/yarnpkg/yarn/tree/master/packages/lockfile
|
||||
// Definitions by: Eric Wang <https://github.com/fa93hws>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Dependency {
|
||||
[packageName: string]: string;
|
||||
}
|
||||
|
||||
interface FirstLevelDependency {
|
||||
version: string;
|
||||
resolved?: string;
|
||||
dependencies?: Dependency;
|
||||
}
|
||||
|
||||
interface LockFileObject {
|
||||
[packageName: string]: FirstLevelDependency;
|
||||
}
|
||||
|
||||
export = parse;
|
||||
|
||||
declare function parse(file: string): { object: LockFileObject };
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@yarnpkg/lockfile": ["yarnpkg__lockfile"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"yarnpkg__lockfile-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,16 @@
|
||||
import parseYarnLock = require('@yarnpkg/lockfile');
|
||||
|
||||
function testFirstLevelDependency(obj: {
|
||||
version: string;
|
||||
resolved?: string;
|
||||
dependencies?: {
|
||||
[packageName: string]: string;
|
||||
}
|
||||
}) {}
|
||||
|
||||
const { object } = parseYarnLock('');
|
||||
|
||||
Object.keys(object).forEach(k => {
|
||||
const value = object[k];
|
||||
testFirstLevelDependency(value);
|
||||
});
|
||||
Reference in New Issue
Block a user