Skip to content

Commit 1429d41

Browse files
authored
🤖 Merge PR DefinitelyTyped#73240 Add Web Install API by @LiaHiscock
1 parent e1ec9a1 commit 1429d41

File tree

5 files changed

+70
-0
lines changed

5 files changed

+70
-0
lines changed

types/web-install-api/.npmignore

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

types/web-install-api/index.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
interface InstallFunction {
2+
(): Promise<string>;
3+
(installUrl: string): Promise<string>;
4+
(installUrl: string, manifestId: string): Promise<string>;
5+
}
6+
7+
interface Navigator {
8+
install?: InstallFunction;
9+
}

types/web-install-api/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"private": true,
3+
"name": "@types/web-install-api",
4+
"nonNpm": true,
5+
"nonNpmDescription": "Web Install API",
6+
"version": "2025.1.9999",
7+
"projects": [
8+
"https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/WebInstall/explainer.md"
9+
],
10+
"devDependencies": {
11+
"@types/web-install-api": "workspace:."
12+
},
13+
"owners": [
14+
{
15+
"name": "Lia Hiscock",
16+
"githubUsername": "LiaHiscock"
17+
},
18+
{
19+
"name": "Kristin Lee",
20+
"githubUsername": "Kbhlee2121"
21+
}
22+
]
23+
}

types/web-install-api/tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"module": "node16",
4+
"lib": [
5+
"es6",
6+
"dom"
7+
],
8+
"noImplicitAny": true,
9+
"noImplicitThis": true,
10+
"strictFunctionTypes": true,
11+
"strictNullChecks": true,
12+
"types": [],
13+
"noEmit": true,
14+
"forceConsistentCasingInFileNames": true
15+
},
16+
"files": [
17+
"index.d.ts",
18+
"web-install-api-tests.ts"
19+
]
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
if (navigator.install) {
2+
// $ExpectType Promise<string>
3+
navigator.install();
4+
5+
// $ExpectType Promise<string>
6+
navigator.install("https://foo.com");
7+
8+
// $ExpectType Promise<string>
9+
navigator.install("https://foo.com", "manifest-id");
10+
11+
// @ts-expect-error
12+
navigator.install(45);
13+
}

0 commit comments

Comments
 (0)