Skip to content

Commit

Permalink
chore: migrate to typescript v5
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Typescript configuration
  • Loading branch information
ahennr authored and simonseyock committed May 6, 2024
1 parent f646ed5 commit bd8812f
Show file tree
Hide file tree
Showing 49 changed files with 470 additions and 373 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
'<rootDir>/dist/'
],
transformIgnorePatterns: [
'node_modules/(?!(ol|@camptocamp/inkmap|@terrestris/react-util|d3-selection)/)'
'node_modules/(?!(ol|@camptocamp/inkmap|@terrestris/react-util|d3-selection|color-space|color-*[a-z]*)|(rc-*[a-z]*)/)'
],
setupFiles: [
'<rootDir>/jest/__mocks__/matchMediaMock.js'
Expand Down
9 changes: 5 additions & 4 deletions jest/setup.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Enzyme from 'enzyme';
import Adapter from '@cfaester/enzyme-adapter-react-18';
import 'whatwg-fetch';
import 'jest-canvas-mock';
import '@testing-library/jest-dom';
import 'regenerator-runtime/runtime';

import Adapter from '@cfaester/enzyme-adapter-react-18';
import Enzyme from 'enzyme';
import {
TextEncoder,
TextDecoder
TextDecoder,
TextEncoder
} from 'util';

Object.assign(global, {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"@terrestris/eslint-config-typescript": "^5.0.0",
"@terrestris/ol-util": "^14.0.0",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.5.1",
"@types/enzyme": "^3.10.15",
Expand Down
5 changes: 2 additions & 3 deletions src/Button/CopyButton/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import AnimateUtil from '@terrestris/ol-util/dist/AnimateUtil/AnimateUtil';
import useMap from '@terrestris/react-util/dist/Hooks/useMap/useMap';
import { DigitizeUtil } from '@terrestris/react-util/dist/Util/DigitizeUtil';
import OlGeometry from 'ol/geom/Geometry';
import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select';
import OlVectorLayer from 'ol/layer/Vector';
import OlVectorSource from 'ol/source/Vector';
Expand All @@ -19,7 +18,7 @@ interface OwnProps {
* The vector layer which will be used for digitize features.
* The standard digitizeLayer can be retrieved via `DigitizeUtil.getDigitizeLayer(map)`.
*/
digitizeLayer?: OlVectorLayer<OlVectorSource<OlGeometry>>;
digitizeLayer?: OlVectorLayer<OlVectorSource>;
/**
* Listener function for the 'select' event of the ol.interaction.Select
* if in `Copy` mode.
Expand All @@ -42,7 +41,7 @@ const CopyButton: React.FC<CopyButtonProps> = ({
...passThroughProps
}) => {

const [layers, setLayers] = useState<[OlVectorLayer<OlVectorSource<OlGeometry>>]|null>(null);
const [layers, setLayers] = useState<[OlVectorLayer<OlVectorSource>]|null>(null);

const map = useMap();

Expand Down
5 changes: 2 additions & 3 deletions src/Button/DeleteButton/DeleteButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import useMap from '@terrestris/react-util/dist/Hooks/useMap/useMap';
import { DigitizeUtil } from '@terrestris/react-util/dist/Util/DigitizeUtil';
import OlGeometry from 'ol/geom/Geometry';
import { SelectEvent as OlSelectEvent } from 'ol/interaction/Select';
import OlVectorLayer from 'ol/layer/Vector';
import OlVectorSource from 'ol/source/Vector';
Expand All @@ -15,7 +14,7 @@ interface OwnProps {
* The vector layer which will be used for digitize features.
* The standard digitizeLayer can be retrieved via `DigitizeUtil.getDigitizeLayer(map)`.
*/
digitizeLayer?: OlVectorLayer<OlVectorSource<OlGeometry>>;
digitizeLayer?: OlVectorLayer<OlVectorSource>;
/**
* Listener function for the 'select' event of the ol.interaction.Select
* if in `Delete` mode.
Expand All @@ -39,7 +38,7 @@ export const DeleteButton: React.FC<DeleteButtonProps> = ({
onFeatureRemove,
...passThroughProps
}) => {
const [layers, setLayers] = useState<[OlVectorLayer<OlVectorSource<OlGeometry>>]|null>(null);
const [layers, setLayers] = useState<[OlVectorLayer<OlVectorSource>]|null>(null);

const map = useMap();

Expand Down
2 changes: 1 addition & 1 deletion src/Button/DrawButton/DrawButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import DrawButton from './DrawButton';

describe('<DrawButton />', () => {

let map;
let map: OlMap;

beforeEach(() => {
map = new OlMap({
Expand Down
6 changes: 3 additions & 3 deletions src/Button/DrawButton/DrawButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ interface OwnProps {
* The vector layer which will be used for digitize features.
* The standard digitizeLayer can be retrieved via `DigitizeUtil.getDigitizeLayer(map)`.
*/
digitizeLayer?: OlVectorLayer<OlVectorSource<OlGeometry>>;
digitizeLayer?: OlVectorLayer<OlVectorSource>;
/**
* Title for modal used for input of labels for digitize features.
*/
Expand Down Expand Up @@ -112,10 +112,10 @@ const DrawButton: React.FC<DrawButtonProps> = ({
}) => {

const [drawInteraction, setDrawInteraction] = useState<OlInteractionDraw>();
const [layer, setLayer] = useState<OlVectorLayer<OlVectorSource<OlGeometry>> | null>(null);
const [layer, setLayer] = useState<OlVectorLayer<OlVectorSource> | null>(null);

/**
* Currently drawn feature which should be represent as label or postit.
* Currently drawn feature which should be represented as label or post-it.
*/
const [digitizeTextFeature, setDigitizeTextFeature] = useState<OlFeature<OlGeometry> | null>(null);

Expand Down
7 changes: 0 additions & 7 deletions src/Button/GeoLocationButton/GeoLocationButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ import { render, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import * as React from 'react';

import TestUtil from '../../Util/TestUtil';
import GeoLocationButton from './GeoLocationButton';

describe('<GeoLocationButton />', () => {

let map;

beforeAll(() => {
enableGeolocationMock();
});
Expand All @@ -22,10 +19,6 @@ describe('<GeoLocationButton />', () => {
disableGeolocationMock();
});

beforeEach(() => {
map = TestUtil.createMap();
});

describe('#Basics', () => {

it('is defined', () => {
Expand Down
Loading

0 comments on commit bd8812f

Please sign in to comment.