Skip to content

Commit d762fc3

Browse files
fix: resolve TypeScript, Jest, and cross-platform compatibility issues (#433)
Co-authored-by: Stephan Meijer <stephan.meijer@gmail.com>
1 parent f3de8ec commit d762fc3

File tree

8 files changed

+27
-25
lines changed

8 files changed

+27
-25
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
timeout-minutes: 5
9696
strategy:
9797
matrix:
98-
leaflet: ["1.6.0", "1.7.1", "1.8.0"]
98+
leaflet: ["1.6.0", "1.7.1", "1.8.0", "1.9.0"]
9999
steps:
100100
- uses: actions/checkout@v4
101101

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ coverage
88
.tmp
99
.docz
1010
.rts2_cache*
11+
pnpm-lock.yaml

jest.config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ module.exports = {
1111
},
1212
testMatch: ['**/*.spec.js'],
1313
transform: {
14-
'^.+\\.(t|j)sx?$': 'ts-jest',
14+
'^.+\\.(t|j)sx?$': [
15+
'ts-jest',
16+
{
17+
tsconfig: {
18+
...tsConfig.compilerOptions,
19+
noEmit: false,
20+
outDir: '.tsCache',
21+
},
22+
},
23+
],
1524
},
1625
automock: false,
1726
setupFiles: ['./jest.setup.js'],
1827
setupFilesAfterEnv: ['./jest.extend.js'],
19-
globals: {
20-
'ts-jest': {
21-
tsConfig: {
22-
...tsConfig.compilerOptions,
23-
noEmit: false,
24-
outDir: '.tsCache',
25-
},
26-
},
27-
},
2828
};

package-lock.json

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
"build:css": "mkdir -p dist && cp ./assets/css/leaflet.css ./dist/geosearch.css",
3434
"build:watch": "npm run build:dist -- --compress false --watch",
3535
"test": "jest",
36-
"lint": "tsc --noEmit && eslint '{docs,src,test}/**/*.{js,ts,tsx}' --quiet --fix && prettier '**/*.{md,mdx,json}' --write",
36+
"lint": "tsc --noEmit && eslint \"{docs,src,test}/**/*.{js,ts,tsx}\" --quiet --fix && prettier \"**/*.{md,mdx,json}\" --write",
3737
"docz:dev": "docz dev",
3838
"docz:build": "cross-env NODE_OPTIONS=--openssl-legacy-provider docz build",
3939
"docz:serve": "docz build && docz serve",
4040
"docs:update": "run-s clean build docz:build && git checkout gh-pages && find . -maxdepth 1 -type f -not -path '*/\\.*' -delete && cp -r .docz/dist/* . && git add . && (git diff --staged --exit-code || git commit -m \"update docs\") && git checkout - && git push origin gh-pages",
4141
"prepublish": "run-s test clean build",
42-
"ci:lint": "eslint '{docs,src,test}/**/*.{js,ts,tsx}' -c ./.eslintrc.js",
42+
"ci:lint": "eslint \"{docs,src,test}/**/*.{js,ts,tsx}\" -c ./.eslintrc.js",
4343
"ci:tsc": "tsc --noEmit --project ./tsconfig.json",
4444
"ci:test": "jest --ci",
4545
"bump:patch": "npm version patch -m 'release: cut the %s release'",
@@ -71,6 +71,7 @@
7171
"@emotion/core": "^10.3.1",
7272
"@types/google.maps": "^3.53.1",
7373
"@types/jest": "^29.1.1",
74+
"@types/leaflet": "^1.9.20",
7475
"@types/lodash.debounce": "^4.0.6",
7576
"@types/react-dom": "^18.0.6",
7677
"@types/react-leaflet": "^2.5.1",

src/SearchControl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ const Control: SearchControl = {
446446
}
447447

448448
if (options.draggable) {
449-
marker.on('dragend', (args) => {
449+
marker.on('dragend', (args: L.DragEndEvent) => {
450450
this.map.fireEvent('geosearch/marker/dragend', {
451451
location: marker.getLatLng(),
452452
event: args,

src/providers/__tests__/bingResponse.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
{
1010
"__type": "Location:http://schemas.microsoft.com/search/local/ws/rest/v1",
1111
"bbox": [
12-
52.099399566650391,
13-
4.2973999977111816,
14-
52.099601745605469,
12+
52.099399566650391, 4.2973999977111816, 52.099601745605469,
1513
4.2975997924804687
1614
],
1715
"name": "Madurodam, Netherlands",

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compileOnSave": false,
33
"compilerOptions": {
4-
"target": "ES2015",
5-
"module": "ES2015",
4+
"target": "ES2022",
5+
"module": "ES2022",
66
"moduleResolution": "node",
77
"esModuleInterop": true,
88
"jsx": "react",

0 commit comments

Comments
 (0)