Skip to content

Commit f17166e

Browse files
authoredNov 6, 2024
feat: build and include element's type declarations (#1353)
* feat: emit map type declarations * feat: emit stacinfo type declarations & fix errors * feat: emit chart type declarations * feat: emit drawtools type declarations * feat: emit geosearch type declarations * feat: emit item filter type declaration * feat: emit jsonform type declarations * feat: emit layercontrol types * feat: emit layout type declarations * feat: emit storytelling type declarations * feat: emit timecontrol type declarations * fix: rename tsconfig * chore: format
1 parent 5894fd9 commit f17166e

25 files changed

+274
-7
lines changed
 

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ custom-elements.json
3232
utils/styles/dist/*.style.js
3333

3434
coverage
35-
.nyc_output
35+
.nyc_output
36+
37+
**/types/**

‎elements/chart/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@
1010
"node": ">=18.0.0"
1111
},
1212
"files": [
13+
"types",
1314
"dist",
1415
"src"
1516
],
1617
"main": "./src/main.js",
18+
"types": "./types/main.d.ts",
19+
"typesVersions": {
20+
"*": {
21+
".": [
22+
"./types/main.d.ts"
23+
],
24+
"src/*": [
25+
"./types/*"
26+
]
27+
}
28+
},
1729
"scripts": {
30+
"prepack": "tsc --project tsconfig.build.json || true",
1831
"build": "vite build",
1932
"watch": "vite build --watch"
2033
},

‎elements/chart/tsconfig.build.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/drawtools/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,24 @@
1111
"node": ">=18.0.0"
1212
},
1313
"files": [
14+
"types",
1415
"dist",
1516
"src"
1617
],
1718
"main": "./src/main.js",
19+
"types": "./types/drawtools/src/main.d.ts",
20+
"typesVersions": {
21+
"*": {
22+
".": [
23+
"./types/drawtools/src/main.d.ts"
24+
],
25+
"src/*": [
26+
"./types/drawtools/src/*"
27+
]
28+
}
29+
},
1830
"scripts": {
31+
"prepack": "tsc -p tsconfig.build.json || true",
1932
"build": "vite build",
2033
"watch": "vite build --watch"
2134
},
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/geosearch/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@
77
"node": ">=18.0.0"
88
},
99
"files": [
10+
"types",
1011
"dist",
1112
"src"
1213
],
1314
"main": "./src/main.js",
15+
"types": "./types/main.d.ts",
16+
"typesVersions": {
17+
"*": {
18+
".": [
19+
"./types/main.d.ts"
20+
],
21+
"src/*": [
22+
"./types/*"
23+
]
24+
}
25+
},
1426
"scripts": {
27+
"prepack": "tsc -p tsconfig.build.json || true",
1528
"build": "vite build",
1629
"watch": "vite build --watch"
1730
},
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/itemfilter/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,24 @@
1212
"node": ">=18.0.0"
1313
},
1414
"files": [
15+
"types",
1516
"dist",
1617
"src"
1718
],
1819
"main": "./src/main.js",
20+
"types": "./types/main.d.ts",
21+
"typesVersions": {
22+
"*": {
23+
".": [
24+
"./types/main.d.ts"
25+
],
26+
"src/*": [
27+
"./types/*"
28+
]
29+
}
30+
},
1931
"scripts": {
32+
"prepack": "tsc -p tsconfig.build.json || true",
2033
"build": "vite build",
2134
"watch": "vite build --watch"
2235
},
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/jsonform/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@
1010
"node": ">=18.0.0"
1111
},
1212
"files": [
13+
"types",
1314
"dist",
1415
"src"
1516
],
1617
"main": "./src/main.js",
18+
"types": "./types/main.d.ts",
19+
"typesVersions": {
20+
"*": {
21+
".": [
22+
"./types/main.d.ts"
23+
],
24+
"src/*": [
25+
"./types/*"
26+
]
27+
}
28+
},
1729
"scripts": {
30+
"prepack": "tsc -p tsconfig.build.json || true",
1831
"build": "vite build",
1932
"watch": "vite build --watch"
2033
},

‎elements/jsonform/tsconfig.build.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/layercontrol/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,24 @@
1616
"node": ">=18.0.0"
1717
},
1818
"files": [
19+
"types",
1920
"dist",
2021
"src"
2122
],
2223
"main": "./src/main.js",
24+
"types": "./types/layercontrol/src/main.d.ts",
25+
"typesVersions": {
26+
"*": {
27+
".": [
28+
"./types/layercontrol/src/main.d.ts"
29+
],
30+
"src/*": [
31+
"./types/layercontrol/src/*"
32+
]
33+
}
34+
},
2335
"scripts": {
36+
"prepack": "tsc -p tsconfig.build.json || true",
2437
"build": "vite build",
2538
"watch": "vite build --watch"
2639
},
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/layout/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@
66
"vite": "^5.0.2"
77
},
88
"files": [
9+
"types",
910
"dist",
1011
"src"
1112
],
1213
"main": "./src/main.js",
14+
"types": "./types/src/main.d.ts",
15+
"typesVersions": {
16+
"*": {
17+
".": [
18+
"./types/main.d.ts"
19+
],
20+
"src/*": [
21+
"./types/*"
22+
]
23+
}
24+
},
1325
"scripts": {
26+
"prepack": "tsc -p tsconfig.build.json || true",
1427
"build": "vite build",
1528
"watch": "vite build --watch"
1629
}

‎elements/layout/tsconfig.build.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts"]
11+
}

‎elements/map/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,24 @@
1919
"node": ">=18.0.0"
2020
},
2121
"files": [
22+
"types",
2223
"dist",
2324
"src"
2425
],
2526
"main": "./src/main.js",
27+
"types": "./types/src/main.d.ts",
28+
"typesVersions": {
29+
"*": {
30+
".": [
31+
"./types/src/main.d.ts"
32+
],
33+
"src/*": [
34+
"./types/src/*"
35+
]
36+
}
37+
},
2638
"scripts": {
39+
"prepack": "tsc --project tsconfig.build.json || true",
2740
"build": "vite build --config vite.config.advancedLayersAndSources.js && vite build --config vite.config.js",
2841
"watch": "vite build --config vite.config.advancedLayersAndSources.js && vite build --config vite.config.js --watch"
2942
}

‎elements/map/tsconfig.build.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": [
11+
"src/**/*.ts",
12+
"src/**/*.js",
13+
"src/**/*.d.ts",
14+
"types.ts",
15+
"typings.d.ts"
16+
]
17+
}

‎elements/stacinfo/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,24 @@
1111
"node": ">=18.0.0"
1212
},
1313
"files": [
14+
"types",
1415
"dist",
1516
"src"
1617
],
1718
"main": "./src/main.js",
19+
"types": "./types/main.d.ts",
20+
"typesVersions": {
21+
"*": {
22+
".": [
23+
"./types/main.d.ts"
24+
],
25+
"src/*": [
26+
"./types/*"
27+
]
28+
}
29+
},
1830
"scripts": {
31+
"prepack": "tsc --project tsconfig.build.json || true",
1932
"build": "vite build",
2033
"watch": "vite build --watch"
2134
},

‎elements/stacinfo/src/helpers/properties.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ export function transformProperties(properties, type = "property") {
2828
// Replace all plain text URLs with clickable links, unless already converted.
2929
property.formatted = property.formatted.replace(
3030
/(?<!href="|src=")(http|https|ftp):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])/gi,
31-
(
32-
// @ts-expect-error TODO
33-
url,
34-
) => {
31+
(url) => {
3532
return `<a target="_blank" href="${url}">${url}</a>`;
3633
},
3734
);

‎elements/stacinfo/src/main.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ export class EOxStacInfo extends LitElement {
115115
/**
116116
* Lifecycle method called when the element's properties change.
117117
* Fetches STAC data and updates properties accordingly.
118-
*
119-
* @param {{has: function}} _changedProperties - The properties that changed.
118+
* @param {Map} _changedProperties
120119
*/
121120
updated(_changedProperties) {
122121
if (_changedProperties.has("for")) fetchSTAC(this);

‎elements/stacinfo/tsconfig.build.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./types",
5+
"noEmit": false,
6+
"declaration": true,
7+
"declarationMap": true,
8+
"emitDeclarationOnly": true
9+
},
10+
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.d.ts", "global.d.ts"]
11+
}

‎elements/storytelling/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@
1010
"node": ">=18.0.0"
1111
},
1212
"files": [
13+
"types",
1314
"dist",
1415
"src"
1516
],
1617
"main": "./src/main.js",
18+
"types": "./types/src/main.d.ts",
19+
"typesVersions": {
20+
"*": {
21+
".": [
22+
"./types/src/main.d.ts"
23+
],
24+
"src/*": [
25+
"./types/src/*"
26+
]
27+
}
28+
},
1729
"scripts": {
30+
"prepack": "tsc -p tsconfig.build.json || true",
1831
"build": "vite build",
1932
"watch": "vite build --watch"
2033
},

0 commit comments

Comments
 (0)
Please sign in to comment.