Skip to content

Commit 45a53d8

Browse files
authored
🤖 Merge PR DefinitelyTyped#74860 [spdx-whitelisted] Add type definitions for spdx-whitelisted by @JamieMagee
1 parent 90dea4c commit 45a53d8

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { ConjunctionInfo, LicenseInfo } from "spdx-expression-parse";
2+
3+
declare function spdxWhitelisted(
4+
first: LicenseInfo | ConjunctionInfo,
5+
second: LicenseInfo[],
6+
): boolean;
7+
8+
export = spdxWhitelisted;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"private": true,
3+
"name": "@types/spdx-whitelisted",
4+
"version": "1.0.9999",
5+
"projects": [
6+
"https://github.com/jslicense/spdx-whitelisted.js"
7+
],
8+
"dependencies": {
9+
"@types/spdx-expression-parse": "*"
10+
},
11+
"devDependencies": {
12+
"@types/spdx-whitelisted": "workspace:."
13+
},
14+
"owners": [
15+
{
16+
"name": "Jamie Magee",
17+
"githubUsername": "JamieMagee"
18+
}
19+
]
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import spdxWhitelisted = require("spdx-whitelisted");
2+
import parse = require("spdx-expression-parse");
3+
4+
// $ExpectType boolean
5+
spdxWhitelisted({ license: "MIT" }, [{ license: "MIT" }]);
6+
7+
// $ExpectType boolean
8+
spdxWhitelisted(parse("MIT"), [
9+
parse("ISC") as parse.LicenseInfo,
10+
parse("MIT") as parse.LicenseInfo,
11+
]);
12+
13+
// $ExpectType boolean
14+
spdxWhitelisted({ license: "GPL-3.0" }, [{ license: "GPL-2.0", plus: true }]);
15+
16+
// $ExpectType boolean
17+
spdxWhitelisted(
18+
{ conjunction: "or", left: { license: "MIT" }, right: { license: "ISC" } },
19+
[{ license: "MIT" }],
20+
);
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+
"spdx-whitelisted-tests.ts"
18+
]
19+
}

0 commit comments

Comments
 (0)