Skip to content

Commit 44a71ee

Browse files
authored
🤖 Merge PR DefinitelyTyped#74840 [correct-license-metadata] Add type definitions for correct-license-metadata by @JamieMagee
1 parent e5fd33d commit 44a71ee

5 files changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!**/*.d.ts
3+
!**/*.d.cts
4+
!**/*.d.mts
5+
!**/*.d.*.ts
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import correctLicenseMetadata = require("correct-license-metadata");
2+
3+
// $ExpectType string | false
4+
correctLicenseMetadata({ license: "MIT" });
5+
6+
// $ExpectType string | false
7+
correctLicenseMetadata({ licenses: [{ type: "MIT" }] });
8+
9+
// $ExpectType string | false
10+
correctLicenseMetadata({ license: "Apache 2" });
11+
12+
// $ExpectType string | false
13+
correctLicenseMetadata({ licenses: ["MIT"] });
14+
15+
// @ts-expect-error
16+
correctLicenseMetadata("MIT");
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
declare function correctLicenseMetadata(metadata: correctLicenseMetadata.PackageMetadata): string | false;
2+
3+
declare namespace correctLicenseMetadata {
4+
interface PackageMetadata {
5+
license?: string | { type?: string; license?: string } | undefined;
6+
licenses?:
7+
| Array<string | { type?: string; license?: string }>
8+
| string
9+
| { type?: string; license?: string }
10+
| undefined;
11+
}
12+
}
13+
14+
export = correctLicenseMetadata;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"private": true,
3+
"name": "@types/correct-license-metadata",
4+
"version": "1.5.9999",
5+
"projects": [
6+
"https://github.com/jslicense/correct-license-metadata.js"
7+
],
8+
"devDependencies": {
9+
"@types/correct-license-metadata": "workspace:."
10+
},
11+
"owners": [
12+
{
13+
"name": "Jamie Magee",
14+
"githubUsername": "JamieMagee"
15+
}
16+
]
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"module": "node16",
4+
"lib": [
5+
"es6"
6+
],
7+
"noImplicitAny": true,
8+
"noImplicitThis": true,
9+
"strictNullChecks": true,
10+
"strictFunctionTypes": true,
11+
"types": [],
12+
"noEmit": true,
13+
"forceConsistentCasingInFileNames": true
14+
},
15+
"files": [
16+
"index.d.ts",
17+
"correct-license-metadata-tests.ts"
18+
]
19+
}

0 commit comments

Comments
 (0)