Skip to content

Commit 598736a

Browse files
authored
Merge pull request #263 from binhpv/master
Add TypeScript configuration and update module imports for compatibility
2 parents 62b05b6 + 3f6e8ea commit 598736a

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"url": "git+https://github.com/maslianok/react-resize-detector.git"
1414
},
1515
"scripts": {
16+
"prebuild": "tsc",
1617
"build": "rollup -c",
1718
"prettier": "prettier --write .",
1819
"lint": "eslint . --fix",

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import useResizeDetector from './useResizeDetector';
1+
import useResizeDetector from './useResizeDetector.js';
22

33
export { useResizeDetector };
44
export type {
@@ -9,4 +9,4 @@ export type {
99
ResfreshModeType,
1010
ResfreshOptionsType,
1111
Dimensions,
12-
} from './types';
12+
} from './types.js';

src/useResizeDetector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useEffect, useState, useRef, useCallback } from 'react';
22
import type { DebouncedFunc } from 'lodash';
33

4-
import { getDimensions, patchResizeCallback, useCallbackRef, useRefProxy } from './utils';
4+
import { getDimensions, patchResizeCallback, useCallbackRef, useRefProxy } from './utils.js';
55

6-
import type { Dimensions, UseResizeDetectorReturn, useResizeDetectorProps } from './types';
6+
import type { Dimensions, UseResizeDetectorReturn, useResizeDetectorProps } from './types.js';
77

88
// eslint-disable-next-line @typescript-eslint/no-explicit-any
99
function useResizeDetector<T extends HTMLElement = any>({

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import debounce from 'lodash/debounce.js';
33
import throttle from 'lodash/throttle.js';
44
import type { DebouncedFunc } from 'lodash';
55

6-
import { OnRefChangeType, Props } from './types';
6+
import { OnRefChangeType, Props } from './types.js';
77

88
export type PatchedResizeObserverCallback = DebouncedFunc<ResizeObserverCallback> | ResizeObserverCallback;
99

tsconfig.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
"rootDir": "src",
44
"declaration": true,
55
"declarationDir": "build",
6-
"module": "esnext",
6+
"module": "NodeNext",
77
"target": "es6",
88
"lib": ["es6", "dom", "es2016", "es2017"],
99
"sourceMap": true,
1010
"strict": true,
1111
"jsx": "react",
12-
"moduleResolution": "node",
12+
"moduleResolution": "nodenext",
1313
"allowSyntheticDefaultImports": true,
1414
"esModuleInterop": true,
1515
"noImplicitAny": false,
1616
"skipLibCheck": true,
17-
"inlineSources": true
17+
"inlineSources": true,
18+
"noEmitOnError": true,
19+
"noEmit": true
1820
},
1921
"include": ["src/**/*"],
2022
"exclude": ["node_modules", "build", "src/**/*.test.tsx"]

0 commit comments

Comments
 (0)