Skip to content

Commit 29eab30

Browse files
committed
Update dependencies and fix types.
1 parent 9dadb02 commit 29eab30

File tree

12 files changed

+7594
-6923
lines changed

12 files changed

+7594
-6923
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v3
1010
with:
1111
ref: ${{ github.event.pull_request.head.sha }}
12-
- uses: actions/setup-node@v2
12+
- uses: actions/setup-node@v3
1313
with:
14-
node-version: 17
14+
node-version: 18
1515
- name: Install Dependencies
1616
run: npm install && npm run bootstrap
1717
- name: Run Tests

package-lock.json

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

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"*.{js,md}": "prettier --write"
1616
},
1717
"devDependencies": {
18-
"husky": "^8.0.1",
19-
"lerna": "^5.1.8",
20-
"lint-staged": "^13.0.3",
21-
"prettier": "^2.7.1"
18+
"husky": "^8.0.2",
19+
"lerna": "^6.1.0",
20+
"lint-staged": "^13.1.0",
21+
"prettier": "^2.8.1"
2222
}
2323
}

packages/typeit-react/package-lock.json

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

packages/typeit-react/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "typeit-react",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "React component for the most versatile JavaScript animated typing utility on the planet.",
55
"homepage": "https://typeitjs.com",
66
"main": "dist/index.umd.js",
77
"module": "dist/index.es.js",
88
"types": "dist/index.d.ts",
99
"scripts": {
1010
"build": "vite build && tsc",
11+
"tsc": "tsc",
1112
"start": "vite serve examples",
1213
"prettier": "prettier --write \"**/*.{md,js}\"",
1314
"test": "echo \"Error: no test specified\" && exit 0",
@@ -37,14 +38,15 @@
3738
"author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",
3839
"license": "GPL-3.0",
3940
"dependencies": {
40-
"@types/react": "^18.0.12",
41-
"react": "^18.1.0",
42-
"react-dom": "^18.1.0",
43-
"typeit": "^8.7.0",
44-
"vite": "^2.9.12"
41+
"@types/react": "^18.0.26",
42+
"react": "^18.2.0",
43+
"react-dom": "^18.2.0",
44+
"typeit": "^8.7.1",
45+
"vite": "^4.0.1"
4546
},
4647
"devDependencies": {
47-
"@babel/preset-typescript": "^7.17.12",
48-
"typescript": "^4.7.3"
48+
"@babel/preset-typescript": "^7.18.6",
49+
"terser": "^5.16.1",
50+
"typescript": "^4.9.4"
4951
}
5052
}

packages/typeit-react/src/index.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from "react";
2+
import { forwardRef } from "react";
23
import { default as TypeItCore, TypeItOptions } from "typeit";
34
const { useRef, useEffect, useState } = React;
45

@@ -18,20 +19,19 @@ const defaultProps: TypeItProps = {
1819
getAfterInit: (instance) => instance,
1920
};
2021

22+
const DynamicElementComponent = forwardRef((props: any, ref) => {
23+
const { as: As } = props;
24+
25+
return <As ref={ref} {...props} />;
26+
});
27+
2128
const TypeIt: React.FunctionComponent<TypeItProps> = (props: TypeItProps) => {
2229
const elementRef = useRef(null);
2330
const instanceRef = useRef(null);
24-
const {
25-
options,
26-
as,
27-
children,
28-
getBeforeInit,
29-
getAfterInit,
30-
...remainingProps
31-
} = props;
31+
const { options, children, getBeforeInit, getAfterInit, ...remainingProps } =
32+
props;
3233
const [shouldShowChildren, setShouldShowChildren] = useState<boolean>(true);
3334
const [instanceOptions, setInstanceOptions] = useState(null);
34-
const DynamicElement = as;
3535

3636
function calculateOptions() {
3737
const optionsClone = Object.assign({}, options);
@@ -75,14 +75,14 @@ const TypeIt: React.FunctionComponent<TypeItProps> = (props: TypeItProps) => {
7575
}, [instanceOptions]);
7676

7777
/**
78-
* Destroy the instace whenever the component unmounts.
78+
* Destroy the instance whenever the component unmounts.
7979
*/
8080
useEffect(() => {
8181
return () => instanceRef.current?.destroy();
8282
}, []);
8383

8484
return (
85-
<DynamicElement
85+
<DynamicElementComponent
8686
ref={elementRef}
8787
children={shouldShowChildren ? children : null}
8888
style={{ opacity: shouldShowChildren ? 0 : 1 }}

packages/typeit-react/src/types/index.d.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/typeit-react/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
"outDir": "dist",
55
"jsx": "react",
66
"module": "es6"
7-
}
7+
},
8+
"include": [
9+
"src/**/*"
10+
]
811
}

0 commit comments

Comments
 (0)