Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration: Migrate to Typescript. #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26,094 changes: 26,094 additions & 0 deletions example/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"devDependencies": {
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
"@types/react-dom": "^17.0.9",
"gh-pages": "^3.2.3"
},
"eslintConfig": {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion example/src/Observer.js → example/src/Observer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import useResizeObserver from 'resize-observer-hook'
import useResizeObserver from 'resize-observer-hook';
import './styles.css'

const Observer = () => {
Expand Down
4 changes: 2 additions & 2 deletions example/src/index.js → example/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './index.css'

import React from 'react'
import ReactDOM from 'react-dom'
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App'

ReactDOM.render(<App />, document.getElementById('root'))
2 changes: 2 additions & 0 deletions example/src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="react-scripts" />
declare module 'resize-observer-hook';
25 changes: 25 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}
63 changes: 61 additions & 2 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"react": "^16.0.0"
},
"devDependencies": {
"microbundle-crl": "^0.13.10",
"@types/react": "^17.0.24",
"babel-eslint": "^10.0.3",
"cross-env": "^7.0.2",
"eslint": "^6.8.0",
Expand All @@ -41,6 +41,7 @@
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^2.2.0",
"microbundle-crl": "^0.13.10",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.4",
"react": "^16.13.1",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js → src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useEffect, useRef } from 'react'
import { useState, useEffect, useRef } from 'react';

const useResizeObserver = (option = 'contentRect') => {
const ref = useRef(null)
Expand Down