@types/react-redux
ํจํค์ง๋ฅผ ์ฌ์ฉํด ๋ณด์๋๋ฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค.Definitions by:
in index.d.ts
) ๋๋ตํ๋ค.@jamesreggio @JounQin
@types/react-redux 7.0.1
์์ @types/react-redux 7.0.2
ํ๋ฉด ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
'/node_modules/hoist-non-react-statics' has no exported member 'NonReactStatics'.
47 import { NonReactStatics } from 'hoist-non-react-statics';
์ฌ๊ธฐ์ ์๊ฐ ๋ ๊ฒ ๊ฐ์ต๋๋ค : https://github.com/DefinitelyTyped/DefinitelyTyped/commit/8b1beff944f6c7bf913b6fcee31fb5f7129064a7
๊ทธ๋ ๊ตฐ์. ๊ทธ ๋ณ๊ฒฝ์์ @types/hoist-non-react-statics
์ ๋ํ ์ข
์์ฑ์ ๋์
ํ์ง๋ง ์ข
์์ฑ์ผ๋ก ์ถ๊ฐํ์ง ์์์ต๋๋ค. ์ด ๋ฌธ์ ๋ ์ ํ์ด ์ ํ์๋ง ์์กดํ๊ธฐ ๋๋ฌธ์ ์ข
์์ฑ์ผ๋ก ์ ์ธํ ์์น๊ฐ ํ์คํ์ง ์๋ค๋ ๊ฒ์
๋๋ค.
@JounQin , ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ์ดํดํ๋ ๋ฐ ๋์์ ์ค ์ ์์ต๋๊น? ///<reference
์ถ๊ฐํ๊ฑฐ๋ package.json
์ ๋ฌด์ธ๊ฐ๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๊น?
์์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก ํ๋ก์ ํธ์ npm install --dev @types/hoist-non-react-statics
๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค.
๋ด๊ฐ ํ๋ฆด ์๋ ์์ง๋ง ๋ฌธ์ ๊ฐ ๋ ๊ฐ๋จ ํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
import { NonReactStatics } from 'hoist-non-react-statics';
ํด์ผํ๋ค
import NonReactStatics from 'hoist-non-react-statics';
@types/react-redux 7.0.1๋ก ๋ค์ด๊ทธ๋ ์ด๋ํ๋ ๊ฒ์ ์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ ๋๊น์ง ๋น ๋ฅธ ์์ ์ ๋๋ค.
์ ๋ ์ค๋ ์ด ๋ฌธ์ ๋ฅผ ๋ฐ์์ต๋๋ค. 7.0.1๋ก ๋ค์ด๊ทธ๋ ์ด๋ํ๋ ๋ฐ ๋์์ด ๋์์ต๋๋ค.
์ฌ๊ธฐ๋ ๋ง์ฐฌ๊ฐ์ง์ ๋๋ค.
๊ทธ๋ ๊ตฐ์. ๊ทธ ๋ณ๊ฒฝ์์
@types/hoist-non-react-statics
์ ๋ํ ์ข ์์ฑ์ ๋์ ํ์ง๋ง ์ข ์์ฑ์ผ๋ก ์ถ๊ฐํ์ง ์์์ต๋๋ค.
ํ์คํTyped๋ @types/hoist-non-react-statics
๋ฅผ @types/react-redux
๋ํ ์ข
์์ฑ์ผ๋ก ์๋ ์ถ๊ฐํ์ง๋ง (๋ถ๋ช
ํ) ํ์ดํ์ด ์๋ํ๊ธฐ์ ์ถฉ๋ถํ์ง ์์์ต๋๋ค.
์์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก ํ๋ก์ ํธ์
npm install --dev @types/hoist-non-react-statics
๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค.
์๋์, ์ด ์ข ์์ฑ์ ์ด๋ฏธ ConfirmedlyTyped์ ์ํด ์๋์ผ๋ก ์ถ๊ฐ๋๊ธฐ ๋๋ฌธ์ ์๋ํ์ง ์์ง๋ง TS๊ฐ ์ ๋ ฅ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ฒ๋ฆฌํ๋ ๊ฒ๋ง์ผ๋ก๋ ์ถฉ๋ถํ์ง ์์ต๋๋ค.
๋ด๊ฐ TS์ด์ ์กด์ฌ๋ฅผ ์ธ์ํ์ง ๋ชปํฉ๋๋คํ๋ ๋ฌธ์ ๋ฅผ ์๊ฐ hoist-non-react-statics
๋ก, ๋ชจ๋ hoist-react-statics
์์ฒด๋ฅผ ํจํค์ง๋ ๋ถ๋๋ฌ์ด (node_modules์ ์กด์ฌํ์ง ์๋ ๊ทธ TS ์์์ํ์ง ํ์ ๋ชจ๋ existince @types/hoist-non-react-statics
ํจํค์ง(ํธํ์ฑ๊ณผ ๊ฐ์ ๋์์ ๋ํ ํ๋นํ ์ด์ ๊ฐ ์์ ์ ์์). ์ด ๊ฐ์ค์ hoist-non-react-statics
๋ฅผ ๋ฉ๋๋ค .
๋ฐ๋ผ์ @jamesreggio ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐ ํ๋ ค๋ฉด package.json
of @types/react-redux
์ ๋ํ ์ข
์์ฑ hoist-non-react-statics
ํจํค์ง๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
@surgeboris ๊ฐ 7.0.3์ผ๋ก ์
๋ฐ์ดํธ๋๊ณ [email protected]
๋ฐ @types/[email protected]
, ๋ฌธ์ ์์
๋๋ฅผ ์ํด ์ค์ ๋ก ์๋ํ์ง ์๋ ์์ . ๋ด๊ฐ ๋ญ๊ฐ ์๋ชปํ๊ณ ์๋์ง๋ ๋ชจ๋ฅธ๋ค. ์ค ์ฌ์ฉ 1.13
๋ค, ๊ธฐ๋ค๋ ค ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
์์ ์ฌํญ์ ์์๋ด๊ณ PR: #33919๋ฅผ ์ด์์ต๋๋ค.
๋ถ๋ช
ํ ๋
ธ๋ ์คํ์ผ ์ ํ ์ ์ ๋ด๋ณด๋ด๊ธฐ( export =
)๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ฐ์ ธ์ค๋ ์ ์ ํ ๋ฐฉ๋ฒ์ import [name] = require([package name])
์
๋๋ค. ๋๋ ์ด๋ฌํ ๊ฐ์ ธ์ค๊ธฐ/๋ด๋ณด๋ด๊ธฐ ํจํด์ ๋์์ค๊ฐ ๋ค์ ๋ฏ์ค๊ณ , ์ด์ ์ผ ์ดํดํ๋ค๋ ๊ฒ์ด ์ด๋ ดํ์ด ํ์ ์ด ๋ค ๋ฟ์
๋๋ค ๐
DefinitielyTyped์ ์ ์ง ๊ด๋ฆฌ์๊ฐ ์ด๋ฅผ ์ต๋ํ ๋นจ๋ฆฌ ๋ณํฉํ๊ณ ๋ฆด๋ฆฌ์คํ ์ ์๊ธฐ๋ฅผ ๋ฐ๋๋๋ค. ํด๋ณดํด์ ๋ค์ ํ ๋ฒ ์ฃ์กํฉ๋๋ค.
๋ถํํ๋ ์ต๊ทผ์ ์ถ์๋ 7.0.4
์๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค.
@types/hoist-non-react-statics
์ ๋ํ ๋ช
์์ ์ข
์์ฑ์ด ์ฌ์ ํ ๋๋ฝ๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ค์ ๋ก, ์๋์ - ์๋ก์ด npm i @types/react-redux
๊ฐ @types/hoist-non-react-statics
. ๋๋ ์๋ฌด ๋ฌธ์ ๊ฐ ๋ณด์ด์ง ์๋๋ค?
์, ์ข
์์ฑ์ package.json
ํ์คํ ๋์ด๋์ด ์์ต๋๋ค.
"dependencies": {
"@types/hoist-non-react-statics": "*",
"@types/react": "*",
"redux": "^4.0.0"
},
์ฌ์ ํ ๋ฌธ์ ๊ฐ ์๋ ๊ฒฝ์ฐ ๋ชจ๋ ํญ๋ชฉ์ ์ฌ๋ฐ๋ฅธ ๋ฒ์ ์ด ์ค์น๋์๋์ง ๋ค์ ํ์ธํด์ผ ํฉ๋๋ค.
(๊ตฌ์ฒด์ ์ผ๋ก ์ข
์์ฑ์ *
๋ก ๋์ด๋๋ฏ๋ก npm
๊ฐ ์ข
์์ฑ์ ๋ง์กฑ์ํค๋ ๊ฒ์ผ๋ก ๊ฐ์ฃผ๋๋ ์ ํ์ด ๋๋ฝ๋ ์ด์ ๋ฒ์ ์ @types/hoist-non-react-statics
๊ฐ ์์ ์ ์์ต๋๋ค.)
๋ฐ๋ผ์ ๋ฌธ์ ๋ ๋ค์ ๋ฏธ๋ฌํ ์ฐจ์ด๊ฐ ์์ต๋๋ค.
hoist-non-react-statics
ํจํค์ง์์ ์์ ์ ํ์ดํผ ๊ธฐ๋ณธ typings์ ํฌํจ v2.2.0
๊น์ง v3.0.0
, ๊ทธ๋ฆฌ๊ณ ๋ง์ฝ์ ๋ฒ์ hoist-non-react-statics
๊ทธ ์ ์์์ ํ๋ก์ ํธ ๋ฃจํธ์ ํด๊ฒฐ๋๋ ๋ฒ์์์ ํจํค์ง ๋ก์ปฌ ์
๋ ฅ์ด @types/hoist-non-react-statics
๋ณด๋ค ์ฐ์ ํ๋ฏ๋ก ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
๋ ๊ฐ์ง ์ฆ๊ฐ์ ์ธ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค.
hoist-non-react-statics@^3.3.0
๋ฅผ ํ๋ก์ ํธ์ ์ข
์์ฑ์ผ๋ก ์ถ๊ฐํฉ๋๋ค.package.json
ํด์๋ ์ฌ์ ์๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ์ถ๊ฐํฉ๋๋ค.
"resolutions": {
"hoist-non-react-statics": "^3.3.0"
}
๋๋ถ๋ถ์ ๊ฐ๋ฐ์๊ฐ ์ฒ์๋ถํฐ hoist-non-react-statics
์ ์กด์ฌ๋ฅผ (์ ํํ๊ฒ) ์ธ์ํ์ง ๋ชปํ๊ธฐ ๋๋ฌธ์ ์ด๋ค ์ค ์ด๋ ๊ฒ๋ ์ต์ ์ด ์๋๋๋ค.
๋ ์ ๋ง ํ์ค ์ต์ ์ ๋ฐฉ๋ฒ์ ์ฌ๊ธฐ์ ์ด๋ป๊ฒ ๋ ์ง ๋ชจ๋ฅด๊ฒ ์ง๋ง, ์ฐ๋ฆฌ๊ฐ versionspec ํน์ ๋ชฉ๋ก ์ ์๋ค๋ฉด ์์ฌ @types/hoist-non-react-statics
๋ด๋ถ์ package.json
์ @types/react-redux
, ์ฐ๋ฆฌ ์ํฅ์ ์ํํ ์ ์์ต๋๋ค.
@weswigham - ๊ทธ๊ฒ์ ๊ฐ๋ฅํ์ด์ ํจ๊ป ์๋ ์์ฑ ์ข
์์ฑ์ ๋์ฒดํ๋ ๊ฒฝ์ฐ์ ๋น์ ์ด ์๊ณ *
์ ์์กด์ฑ์ผ๋ก @types/hoist-non-react-statics
์ >=3.3.0
?
@weswigham โ ์๋ ์์ฑ๋ ์ข ์์ฑ์ *๋ก ๋ฐ๊พธ๋ ๊ฒ์ด ๊ฐ๋ฅํ์ง >=3.3.0์ธ @types/hoist-non-react-
package.json
์ ๋ช
์์ ์ผ๋ก ์ถ๊ฐํ๋ฉด ์๋ํ ๊น์? AFAIK ์์์ ๋๋ ๊ฒฝ๋ก ๋งคํ ๊ธฐ๋ฐ ์ข
์์ฑ์ ๋ํ ๋ฒ์ ์ ํ๋์ฝ๋ฉํ ์๋ ์์ง๋ง ํ๋ฆด ์ ์์ต๋๋ค.
@sandersn ์ด ๋ ์๊ณ ์์ต๋๊น?
๋ฐฉ๊ธ package.json
์ @types/hoist-non-react-statics
์ ํน์ ๋ฒ์ ์ด ํฌํจ๋ PR์ ์ด์์ต๋๋ค. ํฌ๋ง์ด ์๋ํฉ๋๊น? ํ์คํ ๋ค์น ์๋ ์์๋ค.
@weswigham , ๊ฒํ ํ๊ณ ์น์ธํ์๊ฒ ์ต๋๊น?
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/33979
๊ทธ๊ฒ์ด ์ฌ๋ฐ๋ฅธ ์์ ์ธ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. hoist-non-react-statics@latest
์ ๋ํ ์ง์ ์ข
์์ฑ์ ์ถ๊ฐํ๊ณ ๋ชจ๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
์ด, @weswigham + @sandersn โ ๋ฌด์์ ํด์ผ ํ ์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. @types/hoist-non-react-statics
๋ํ ํน์ ๋ฒ์ ์ฌ์์ ์ถ๊ฐํ๊ธฐ ๋๋ฌธ์ Travis ๋น๋๊ฐ ์คํจํ์ต๋๋ค. ์ฌ๊ธฐ ์์ ์ค๋ฅ๋ฅผ ์ฐธ์กฐ
@types/react-redux
_requires_ ์ต์ 3.3.0 of @types/hoist-non-react-statics
๋ก ๋ณ๊ฒฝํ ๊ฒ์ด ์ฌ์ค์ด๋ฏ๋ก ๊ทธ ์ ์ฝ์ ํํํ ์ ์์ด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. ๊ทธ ๋ฐฉ๋ฒ์ ์ดํดํ๋ ๋ฐ ๋์์ ์ค ์ ์์ต๋๊น? (์ค๋ฅ ๋ฉ์์ง๋๋ก ํด์ dependenciesWhitelist.txt
in types-publisher
ํด์ผ ํ ๊น์? ๋๋ฌด ํฐ ๋ง์น ๊ฐ์ต๋๋ค.)
๋๋ฌด ํฐ ๋ง์น๋ ์๋๋๋ค. ๊ทํ์ ๋ฌธ์ ๋ ๋ก๊ทธ ๋ฉ์์ง๊ฐ ์ค๋ช ํ๋ ๊ฒ๊ณผ ๊ฑฐ์ ๋์ผํฉ๋๋ค(๋จ, ๋ฐฐ์ก ์ ํ์ด ์๋ ๊ธฐ๋ณธ ํจํค์ง๋ก ๋ค์ ํ ๋ฒ ๊ต์ฒด๋์๋ค๋ ์ ์ ์ ์ธ).
์ข์ต๋๋ค. types-publisher
์ ๋ณํฉํ PR์ด ์์ต๋๋ค. https://github.com/Microsoft/types-publisher/pull/595
@weswigham โ ์ฐฉ๋ฅํ ์ ์์ต๋๊น?
PDT 3:06(์ด ๋๊ธ 40๋ถ ์ )์ ๊ฒ์๋์์ต๋๋ค.
์ข์ต๋๋ค. @types/[email protected]
ํ ๋ฒ ์๋ํด ๋ณด๊ณ ์ฌ์ ํ ๋ฌธ์ ๊ฐ ์์ผ๋ฉด ์๋ ค์ฃผ์ธ์.
@types/[email protected]
์ฌ์ ํ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋๋ฅผ ์ํด ์ผํ ์ ์ผํ ์์ ์ ๋ด ํ๋ก์ ํธ์์ ์๋์ผ๋ก hoist-non-react-statics
๋ฅผ ์๊ตฌํ๋ ๊ฒ์
๋๋ค.
๋ ๋ฒ์งธ, @types/ [email protected] ์์ ์ฌ์ ํ ๊นจ
@jamesreggio @weswigham ๋๊ธ์ ๋ณด์๋์ง ๋ชจ๋ฅด๊ฒ ์ง๋ง ํ์ ์ณ์ ๋ณด์ จ์ ๊ฒ์ ๋๋ค.
๋ค, ๊ฐ์ฌํฉ๋๋ค. ์ ๋ ์ค๋ ์คํ Cisco์์ React๋ฅผ ๊ฐ๋ฅด์น๊ณ ์์์ต๋๋ค. ๋น ๋ฅธ ํ์ธ ํ ์ด ์ค๋ ๋๋ฅผ ์ฐพ์๊ณ ๋ค์ 7.0.1๋ก ๋๋๋ ธ๊ณ ์ ์์ ์ผ๋ก ์๋ํ์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ์ ๊ฐ ์กฐ๊ธ ์ด์ํ ์ ์ด ์์ต๋๋ค. hoist-non-react-statics๋ฅผ ์ถ๊ฐํ๋ฉด ์์์ ์ค๋ช ํ ๋๋ก ์๋ํฉ๋๋ค. hoist-non-react-statics๋ฅผ ์ ๊ฑฐํ๋ฉด ๊ณ์ ์๋ํฉ๋๋ค. ๋ฐ๋ผ์ ๊ฑฐ๊ธฐ์์ ์ ํ๋๋ ์ค์ ์ข ์์ฑ์ด ์์ ์ ์์ง๋ง ํด๋น ํจํค์ง๋ฅผ ์ ๊ฑฐํ๋๋ผ๋ ๊ณ์ ๋จ์ ์์ต๋๋ค. node_modules์ package-lock.json์ ์ง์ฐ๊ณ ํธ์ด์คํธ ์์ด ๋ค์ ์ค์นํ๋ฉด ๋ค์ ๊นจ์ง๋๋ค. ๋๋ ์ง๊ธ ์ฌ๊ธฐ์ ๋๊ฐ์ผ ํ๋ฏ๋ก ๋ ๊น์ด ํ๊ณ ๋ค๋ ค๊ณ ํ๋ ์ง๊ธ ๋น์ฅ ์๊ฐ์ ํ ์ ํ ์ ์์ต๋๋ค. ๋ค๋ฅธ ์ฌ๋์ ์ด์จ๋ ํจํค์ง์ ๋ ์ ์กฐํ๋๋ ๊ฒ์ด ๋ ๋น ๋ฅด๋ค๋ ๊ฒ์ ์ ์ ์์ต๋๋ค.
๋ด์ผ ๋ค์ ํํค์ณ๋ด์ผ๊ฒ ์ง๋ง ์์งํ ๋์์ด ํ์ํด
์ ๋ฌธ๊ฐ๋ก๋ถํฐ. TS ๋ชจ๋ ์์คํ
์ ๋ณต์ก์ฑ์ ๋๋ฅผ ๋นํฉํ๊ฒ ํฉ๋๋ค. ๋๋ ๋๋๋ค
์ฌ๊ธฐ์์ ๋ชจ๋ ๊ฒ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ํ ํ ๊ฒ์ฒ๋ผ ...
๋ฌธ์ ๊ฐ ์๋ ๋ถ๋ค์ ๊ทํ์ ์์ ์ ๋ถ์ฌ๋ฃ์ผ์ญ์์ค.
package-lock.json ๋๋ yarn.lock? ๋๋ ์ด๊ฒ์ด ๊ด๋ จ ๋ฌธ์ ์ผ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
hoist-non-react-statics์ ์์ฒด ํ์ดํ์ด ํฌํจ๋์ด ์๋ค๋ ํน์ดํ ์ฌ์ค์ ๋ํด
๊ณผ๊ฑฐ์ ์งง์ ๊ธฐ๊ฐ ๋์.
2019๋ 3์ 21์ผ ๋ชฉ์์ผ 20:03 Joel Mussman [email protected]์์ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
๋ค, ๊ฐ์ฌํฉ๋๋ค. ์ ๋ ์ค๋ ์คํ Cisco์์ React๋ฅผ ๊ฐ๋ฅด์น๊ณ ์์์ต๋๋ค.
์์ ์ ๋ฌผ์์ต๋๋ค. ๋น ๋ฅธ ํ์ธ ํ ์ด ์ค๋ ๋๋ฅผ ์ฐพ์์ต๋๋ค.
7.0.1๊น์ง ๋ด๋ ค๊ฐ๊ณ ์ ์์ ์ผ๋ก ์๋ํ์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ์ ๊ฐ ์กฐ๊ธ ์ด์ํ ์ ์ด ์์ต๋๋ค. ๋ด๊ฐ ์ถ๊ฐํ๋ฉด
hoist-non-react-statics ์์์ ์ค๋ช ํ ๋๋ก ์๋ํฉ๋๋ค. ๋ด๊ฐ ์ ๊ฑฐํ๋ฉด
hoist-non-react-statics ๊ณ์ ์๋ํฉ๋๋ค. ๊ทธ๋์ ์ง์ง๊ฐ ์์์ง๋ ๋ชฐ๋ผ
๊ฑฐ๊ธฐ์์ ์ ํ๋์ง๋ง ์ ๊ฑฐํ๋๋ผ๋ ๊ณ์ ๋จ์์๋ ์ข ์์ฑ
๊ทธ ํจํค์ง. node_modules ๋ฐ package-lock.json์ ์ง์ฐ๊ณ
ํธ์ด์คํธ์์ด ๋ค์ ์ค์นํ๋ฉด ๋ค์ ๊ณ ์ฅ๋ฉ๋๋ค. ๋๋ ์ง๊ธ ์ฌ๊ธฐ์ ๋๊ฐ์ผ ํ๋ค.
๊ทธ๋์ ๋ ๊น์ด ํ๊ณ ๋ค๋ ค๊ณ ๋ ธ๋ ฅํ๋ ์ง๊ธ ๋น์ฅ์ ๋ ์ด์ ์๊ฐ์ ํ ์ ํ ์ ์์ต๋๋ค.
๋ค๋ฅธ ์ฌ๋์ ์ด์จ๋ ๋ ๋นจ๋ฆฌ ์กฐ์ ํ ์ ์์ต๋๋ค.
ํจํค์ง.โ
๋น์ ์ด ์ธ๊ธ๋์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33690#issuecomment-475477877 ,
๋๋ ์ค๋ ๋ ์์๊ฑฐ
https://github.com/notifications/unsubscribe-auth/AAyLva1P2ZGe86669tG7yu7fe1yMWWf-ks5vZEgHgaJpZM4bjI1Z
.
์ฌ๊ธฐ ๋ด package-lock.json
: https://github.com/hellomouse/GNS/blob/greenkeeper/default/%40types/react-redux-7.0.5/dashboard/package-lock.json
์๋ ํ์ธ์ ์ ์์ค,
์๊ฒ ์ต๋๋ค. ์์ ํ๋ก์ ํธ์์ ๋ฌด์์ด ์๋ชป๋์๋์ง ์ดํดํฉ๋๋ค. ์์ง ์์ ํ๋ ๋ฐฉ๋ฒ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ด๊ฐ ์๋ ๊ฒ์ ๊ณต๊ฐํ ๊ฒ์ด๋ฉฐ ์๋ง๋ ํ์คํ ์ ํํ์ ๋๊ตฐ๊ฐ๊ฐ ๋น์ ์ ๋์ธ ์ ์์ ๊ฒ์ ๋๋ค.
react-router๋ ์ด์ ์ค์ต์์ react-redux๋ณด๋ค ๋จผ์ ์ค์น๋์์ต๋๋ค. react-router์ ํ์ฌ ๋ฒ์ (4์ผ ์ ๊น์ง)์ 4.3.1 ์ด์๊ณ [email protected]์ ์ข ์๋์ด [email protected] ์ด ์ค์น๋์์ต๋๋ค. [email protected]์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค [email protected] ์ @types/react-redux ์ข ์์ฑ์ ์ต์์ ์์ค์ด ์๋๊ธฐ ๋๋ฌธ์ ์ฐพ์ง ๋ชปํ๋ ๊ฒ์ผ๋ก
์์์ ์ค๋ช ํ ๋ค๋ฅธ ์ฌ๋๋ค์ ๋ฌธ์ ๋ ์ด ์๋๋ฆฌ์ค์ ๋งค์ฐ ์ ์ฌํ ์ ์์ต๋๋ค.
๊ด๋ จ ์ง๋ฌธ: @types/react-redux์ ์ด๋ค ๋ฒ์ ์ด react-redux์ ์ด๋ค ๋ฒ์ ์ ๋งคํ๋๋์ง ์ด๋ป๊ฒ ์ ์ ์์ต๋๊น? ์ซ์๊ฐ ์ผ์นํ์ง ์๊ธฐ ๋๋ฌธ์ ๋๋ ๊ฑฐ๊ธฐ์์ ๊ธธ์ ์์ต๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด PR์ ํ์ต๋๋ค. #34090
๊ทผ๋ณธ์ ์ธ ๋ฌธ์ ๊ฐ ๋ฒ์ 7.0.5์์ ์์ง ์์ ๋์ง ์์๊ธฐ ๋๋ฌธ์ ์ด ๋ฌธ์ ๋ฅผ ๋ค์ ์ด์ด์ผ ํ์ง ์์ต๋๊น?
(devDependencies์ @types/hoist-non-react-statics + hoist-non-react-statics๋ฅผ ์ถ๊ฐํ์ง ์๊ณ )
100% ์ด๊ฒ์ด ๋ซํ์ง ์์์ผ ํ๋ค๋ ๋ฐ ๋์ํ๋ฉฐ devDependancies์ ์๋์ผ๋ก ์ถ๊ฐํ์ง ์๋ ํ ์ฌ์ ํ ์ค๋จ๋ฉ๋๋ค.
์ฌ๊ธฐ ์ฌ๋๋ค์ด ์ฒ์๋ถํฐ ๋ฌด์ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด๋ ์ ์ ํ ์์ ์ฌํญ์ ์ ์ถํ์ต๋๋ค. #34406
์ด์ PR์ด ๋ณํฉ๋์์ผ๋ฏ๋ก react-redux ์ ํ์ hoist-non-react-statics์ ๋ํ ์ข ์์ฑ์ ์ ๋ฐ์ดํธํด์ผ ํฉ๋๊น?
๋๋ ๊ทธ๋ ๊ฒ ์๊ฐํด. ํ์ง๋ง ์ข ์์ฑ์ ์ ๊ฑฐํ๊ณ (์ ๊ฑฐ) ๋ค์ ์ถ๊ฐํ๋ ๊ฒ์ผ๋ก ๋ฒ์ด๋ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
๋ณด๋ธ ์ฌ๋: Maurice [email protected]
๋ณด๋ธ ๋ ์ง: 2019๋
4์ 4์ผ ๋ชฉ์์ผ ์คํ 3:53:32
๋ฐ๋ ์ฌ๋: ํ์คํ๊ฒ ์
๋ ฅ๋จ/ํ์คํ ์
๋ ฅ๋จ
์ฐธ์กฐ: wolfy1339; ์ค๋ช
์
์ ๋ชฉ: Re: [DefinitelyTyped/DefinitelyTyped] [@types/react-redux] 'hoist-non-react-statics'์ ๋ด๋ณด๋ธ ๋ฉค๋ฒ 'NonReactStatics'๊ฐ ์์ต๋๋ค(#33690).
์ด์ PR์ด ๋ณํฉ๋์์ผ๋ฏ๋ก react-redux ์ ํ์ hoist-non-react-statics์ ๋ํ ์ข ์์ฑ์ ์ ๋ฐ์ดํธํด์ผ ํฉ๋๊น?
โ
์ด ์ค๋ ๋์ ๊ฐ์
ํ๊ธฐ ๋๋ฌธ์ ์ด ๋ฉ์์ง๋ฅผ ๋ฐ๊ณ ์์ต๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅ์ ๋ณด๋ด๊ฑฐ๋ GitHub https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33690#issuecomment-480039685 ์์ ํ์ธํ๊ฑฐ๋ https://github.com/notifications/unsubscribe-auth/AEYfFbvvu7_1ZrU42jUU ์ค๋ ๋๋ฅผ ์์๊ฑฐ
react-redux ํ์ดํ์ ๋ง์ํ์๋ ๊ฑด๊ฐ์? ๋๋ ๊ทธ๊ฒ์ ์๋ํ ๊ฒ์ด๋ค.
@wolfy1339 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/34406 ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง ๋ชปํ ๊ฒ ๊ฐ์ต๋๋ค. hoist-non-react-statics
๊ฐ @types/hoist-non-react-statics
( node_modules/@types/hoist-non-react-statics/node_modules/hoist-non-react-statics
) ๋ด๋ถ์ ์ค์น๋ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ TS๊ฐ ์ฌ์ ํ ๋ด ๋ฃจํธ ๋ฒ์ ( node_modules/hoist-non-react-statics
)์ ์ ํ์ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
์ด ์์ ์์ ์๋ํด ๋ณผ ๊ฐ์น๊ฐ ์์ต๋๋ค. ๋ค๋ฅธ ์ฌ๋์ด ์์ด๋์ด๊ฐ ์์ต๋๊น?
@weswigham ์ด ๋ฌธ์ ๋ฅผ ๋ค์ ์ด ์ ์์ต๋๊น?
๋น์ทํ ๋ฌธ์ ๊ฐ ์์์ต๋๋ค - npm ๋์ yarn์ ์ฌ์ฉํ์ฌ ์ข ์์ฑ์ ์ค์นํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค. ์๋ง๋ ๋น์ ์ด ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก ์๋ํด ๋ณผ ์ ์๊ธฐ ๋๋ฌธ์ ๋ถ์์ ์ผ๋ก ๊ฒ์ํ์ญ์์ค.
@alan-mroczek ์ฐ๋ฆฌ๋ ์์ฌ๋ฅผ ์ฌ์ฉํ๋ฏ๋ก ๋์์ด ๋์ง ์์ต๋๋ค. ์ฌ๊ธฐ์๋ ๋ค๋ฅธ ๋ฌด์ธ๊ฐ๊ฐ ์์ด์ผ ํฉ๋๋ค. (์ ๊ธ ํ์ผ?)
์ ํํ ๋ฌธ์ ๋ฅผ ์ดํดํ๊ณ ์๋์ง๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง, ์์ฌ๋ก ์์ ํ ์๋ฃจ์ ์ package.json์ resolution ํ๋๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ด์์ต๋๋ค.
"resolutions": {
"hoist-non-react-statics": ">=3.3.0"
}
์ด ๋ฌธ์ ๋ "@types/react-redux": "7.0.8",
๋ํด ์ฌ์ ํ ํ์ฑํ๋์ด ์์ผ๋ฉฐ "ํด์๋"๋ฅผ ์ค์ ํ๋ ๊ฒ์ "ํด์๋"๊ฐ monorepo(์์ฌ ์์
๊ณต๊ฐ)์์ ์๋ํ์ง ์๊ธฐ ๋๋ฌธ์ ๋ณดํธ์ ์ธ ์๋ฃจ์
์ด ์๋๋๋ค.
๊ทธ๋ฆฌ๊ณ ๋๋ ๊ทธ๊ฒ์ด ์ด์จ๋ ํด๊ฒฐ์ฑ ์ด ๋ ๊ฒ์ด๋ผ๊ณ ๊ธฐ๋ํ์ง ์์ต๋๋ค. ์ ์๊ฐ์๋ @types ํจํค์ง๊ฐ ์ค์น๋ ํ "๊ทธ๋ฅ ์๋"ํด์ผ ํฉ๋๋ค.
์ด ์ ์ฒด ์๋ จ์ ๋ํ ํด๊ฒฐ์ฑ ์ ์ด๋ฅผ ํผ์ด ์ข ์์ฑ์ผ๋ก ์ถ๊ฐํ๋ ๊ฒ์ ๋๊น? ๋ฌผ๋ก ์๋ฒฝํ์ง๋ ์์ง๋ง typescript๊ฐ ํ์ํ ์ข ์์ฑ์ ์ฐพ๋๋ก ๋ณด์ฅํ๋ ์ ์ผํ ๋ฐฉ๋ฒ์ ๋๋ค.
Android์ฉ Outlook ๋ค์ด๋ก๋ https://aka.ms/ghei36
๋ณด๋ธ ์ฌ๋: Maurice [email protected]
๋ณด๋ธ ๋ ์ง: 2019๋
4์ 29์ผ ์์์ผ ์คํ 12:30:06
๋ฐ๋ ์ฌ๋: ํ์คํ๊ฒ ์
๋ ฅ๋จ/ํ์คํ ์
๋ ฅ๋จ
์ฐธ์กฐ: wolfy1339; ์ธ๊ธํ๋ค
์ ๋ชฉ: Re: [DefinitelyTyped/DefinitelyTyped] [@types/react-redux] 'hoist-non-react-statics'์ ๋ด๋ณด๋ธ ๋ฉค๋ฒ 'NonReactStatics'๊ฐ ์์ต๋๋ค(#33690).
๊ทธ๋ฆฌ๊ณ ๋๋ ๊ทธ๊ฒ์ด ์ด์จ๋ ํด๊ฒฐ์ฑ ์ด ๋ ๊ฒ์ด๋ผ๊ณ ๊ธฐ๋ํ์ง ์์ต๋๋ค. ์ ์๊ฐ์๋ @types https://github.com/types ํจํค์ง๊ฐ ์ค์น๋ ํ "๊ทธ๋ฅ ์๋"ํด์ผ ํฉ๋๋ค.
โ
๋น์ ์ด ์ธ๊ธ๋์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์
๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ฑฐ๋ GitHub https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33690#issuecomment-487649204 ์์ ํ์ธํ๊ฑฐ๋ https://github.com/notifications/unsubscribe-auth/ABDB6FL2OUVTTX754VHAMRCVMQ4PA5 ์ค๋ ๋๋ฅผ ์์๊ฑฐ
๋ง์ ๊ฒ์ ์๋ํ์ง๋ง @types/react-redux 7.0.1๋ก ๋ค์ด๊ทธ๋ ์ด๋ํ๋ ๊ฒ์ด ์ฌ์ ํ ํ์ฌ ์๋ํ๋ ์ ์ผํ ์์ ์ฌํญ์ ๋๋ค.
๋์๊ฒ๋ ๋ง์ฐฌ๊ฐ์ง! ํ์ง๋ง ์ธ์ ๊ฐ๋ ์ง์ ํ ์์ ์ด ์ด๋ฃจ์ด์ง๊ธธ ๋ฐ๋๋๋ค(์ด ์ค๋๋ ์ข ์์ฑ์ ์ ์งํ๋ ๊ฒ์ ์ด์ํฉ๋๋ค!).
react-redux ํ์ดํ์์ #34406๊ณผ ๋์ผํ ์์
์ ์ํํ๊ณ hoist-non-react-statics
์ ์ง์ ์ข
์์ฑ์ ์ถ๊ฐํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. NPM & Yarn์ด ๋ฐ๋์ "์ฌ๋ฐ๋ฅธ" ๋ฒ์ ์ ๋ฃ์ง ์์ ๊ฒ์ด๊ธฐ ๋๋ฌธ์
๋๋ค. hoist-non-react-statics
์์ ๋๋ ํ ๋ฆฌ์ @types/react-redux
(์ด ๊ฒฝ์ฐ TS๊ฐ v2.5์ ๋ด์ฅ index.d.ts
๊ฐ์ ธ์ด)
์ด๊ฒ์ ์ ๋ง ์ง๋
ํ ์๋ฃจ์
์
๋๋ค(TypeScript๊ฐ @types/hoist-non-react-statics/index.d.ts
์ง์ ๊ฐ์ ธ์ฌ ์ ์๋๋ก ํ๋ฉด ์ด๋ก ์ ์ผ๋ก ์ํ๋ ์ ์์ง๋ง ํฉ๋ฆฌ์ ์ธ ๋์์ด ์์ต๋๋ค(๊ธฐ๋ณธ์ ์ผ๋ก @types/hoist-non-react-statics
์ ์์กดํ๋ ๋ค๋ฅธ ์ฌ๋). ๋๊ฐ์ดํด์ผ ํ ๊ฒ์
๋๋ค)
react-redux ํ์ดํ์์ #34406๊ณผ ๋์ผํ ์์ ์ ์ํํ๊ณ
hoist-non-react-statics
์ ์ง์ ์ข ์์ฑ์ ์ถ๊ฐํด์ผ ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. NPM & Yarn์ด ๋ฐ๋์ "์ฌ๋ฐ๋ฅธ" ๋ฒ์ ์ ๋ฃ์ง ์์ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ ๋๋ค.hoist-non-react-statics
์์ ๋๋ ํ ๋ฆฌ์@types/react-redux
(์ด ๊ฒฝ์ฐ TS๊ฐ v2.5์ ๋ด์ฅindex.d.ts
๊ฐ์ ธ์ด)์ด๊ฒ์ ์ ๋ง ์ง๋ ํ ์๋ฃจ์ ์ ๋๋ค(TypeScript๊ฐ
@types/hoist-non-react-statics/index.d.ts
์ง์ ๊ฐ์ ธ์ฌ ์ ์๋๋ก ํ๋ฉด ์ด๋ก ์ ์ผ๋ก ์ํ๋ ์ ์์ง๋ง ํฉ๋ฆฌ์ ์ธ ๋์์ด ์์ต๋๋ค(๊ธฐ๋ณธ์ ์ผ๋ก@types/hoist-non-react-statics
์ ์์กดํ๋ ๋ค๋ฅธ ์ฌ๋). ๋๊ฐ์ดํด์ผ ํ ๊ฒ์ ๋๋ค)
'../hoist-non-react-statics'์์ ๊ฐ์ ธ์ค๋ ๊ฒ์ ์ด๋ป์ต๋๊น?
๋ด๊ฐ ๋ณผ ๋ '@types/hoist-non-react-statics' ํจํค์ง๋ '@types/react-redux'๊ฐ ์ค์น๋ ๋ ์๋์ผ๋ก ์ค์น๋๋ฏ๋ก ๋๋ฝ๋ ์ํ์ด ์์ด์ผ ํฉ๋๋ค.
๋์๊ฒ ์ ํฉํ ์๋ฃจ์
์ ๋ณด์ฌ์ฃผ๊ธฐ ์ํด 2๊ฐ์ ํ์ผ์ ์ฒจ๋ถํ์ต๋๋ค.
hoist-non-react-statics_index.d.txt
๋ฐ์ redux_index.d.txt
npm์ด ์๋ํ๋ ๋ฐฉ์์ ๊ณ ๋ คํ ๋ hoist-non-react-statics
ํ์ดํ์ด react-redux
์ ํ์ ๋๋ ํ ๋ฆฌ์ ์๋ค๊ณ ๋ณด์ฅํ ์ ์์ต๋๋ค. ์ฌ์ฉ์๊ฐ ์ค์นํ ๋ค๋ฅธ ์ข
์์ฑ์ ๋ฐ๋ผ ์กฐ๋ถ๋ชจ์ผ ์๋ ์๊ณ ์์์ผ ์๋ ์์ต๋๋ค.
์ด๊ฒ์ ์ฌ์ ํ โโ๋๋ฅผ ์ํด ๊นจ์ก์ต๋๋ค. ๋ด export default connect()(MyComponent)
์ any
์ ํ์ด ์ง์ ๋ฉ๋๋ค. 7.0.1
๋์๊ฐ์ ์ด ๋ถ๋ถ์ ์์ ํ์ต๋๋ค... ์ด๊ฒ์ 7.0.2
์ ๋ณ๊ฒฝ ์ฌํญ์ธ ๊ฒ ๊ฐ์ต๋๋ค.
์คํธ๋ก ๋ฐ์ 7.1.0
๋ฐ ๋ค์ด ๊ทธ๋ ์ด๋ 7.0.1
์ฐ๋ฆฌ์ ๋ํ ์ต์
์ด๋์ง ์๊ธฐ ๋๋ฌธ์ ์ฐ๋ฆฌ๊ฐ ํ์ TS 3.5.2
(์ TS 3.4.5
, 7.0.1
์๋) 7.0.1
์ ํจ๊ป ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
node_modules/@types/react-redux/index.d.ts:109:84 - error TS2344: Type 'GetProps<C>' does not satisfy the constraint 'Shared<TInjectedProps, GetProps<C>>'.
Type 'unknown' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
๊ทธ๋์, ์ด๋ค .. ํด๊ฒฐ ๋ฐฉ๋ฒ? ๋๋ ๊ทธ ์ฃผ์ ์ ๋ํ ์ ๋ฌธ๊ฐ๊ฐ ์๋๊ธฐ ๋๋ฌธ์ ๋ด๊ฐ ์ด๊ฒ์ ๊ฐ์ง๊ณ ๋ฌด์์ ํด์ผ ํ๋์ง ์ดํดํ ์ ์๋ค.
@tsakalidiskostas
๊ธ์, ์ฐ๋ฆฌ๋ react-redux
์ ํ์ ์์ ๋ ๋ฒ์ ์ ์ ์ฅ์์ ์ปค๋ฐํ๊ธฐ๋ก ๊ฒฐ์ ํ์ต๋๋ค. ( patch-package ๋ฅผ ์ฌ์ฉํ์ง ์๊ธฐ๋ก ๊ฒฐ์ ํ ํ ํ์ํ ์์ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ๋ง์์ ๋ค์ง ์์ผ๋ฉด ์์ ํด๊ฒฐ์ฑ
์ด ๋ ์ ์์ต๋๋ค.)
์ฌ๊ธฐ์ ์ฐ๋ฆฌ๋ ๋จ์ํ ๋ค์ ์ค์ ๋ณ๊ฒฝํฉ๋๋ค.
> = ComponentClass<JSX.LibraryManagedAttributes<C, P>> & hoistNonReactStatics.NonReactStatics<C> & {
์๊ฒ:
> = ComponentClass<JSX.LibraryManagedAttributes<C, P>> & {
์ฐ๋ฆฌ๋ ์ ์ ์ ์ฌ์ฉํ์ง ์๊ธฐ ๋๋ฌธ์ ์ฐ๋ฆฌ์๊ฒ ํด๋ฅผ ๋ผ์น์ง๋ ์์ง๋ง ๋ฌผ๋ก ๋ชจ๋ ์ฌ๋์ด ์์ฉํ ์ ์๋ ์๋ฃจ์ ์ ์๋ ์๋ ์์ต๋๋ค.
๋ฉ์๋! ๋๋ @alessioprestileo ์ ๋ณ๊ฒฝ ์ ์๊ณผ ํจ๊ป ๊ฐ๋ค.
import hoistNonReactStatics = require('hoist-non-react-statics');
~์์ํ
import { NonReactStatics } from '../hoist-non-react-statics';
ํตํ๋ฅผ ๋ค์์ผ๋ก ๋ณ๊ฒฝ
> = ComponentClass<JSX.LibraryManagedAttributes<C, P>> & NonReactStatics<C> & {
๊ทธ๋ฆฌ๊ณ ๊ทธ๊ฒ์ ์ ์๊ฒ๋ ํจ๊ณผ์ ์ด์์ต๋๋ค. ์ค์ ๋ก ๊ทํ์ ๋ต๋ณ์ ๋ณด์์ ๋ ์ ๋ฐ์ดํธ๋ก ํฅํ๊ณ ์์์ต๋๋ค. D
์์ ์ฌํญ์ด ํฌํจ๋ ์ ๋ฒ์ ์ npm์ ๊ฒ์ํ์๊ฒ ์ต๋๊น? :)
hoist-non-react-statics์ ์ ์ง ๊ด๋ฆฌ์๊ฐ ์ ๋ ฅ์ ๋ค์ ์ ์ฅ์๋ก ํ์ธํ๋๋ก ํ ์ ์์ต๋๊น?
๊ทธ๋์ .. ์ด๋ฐ ์ผ์ด ์ผ์ด๋๊ณ ์์ต๋๊น ์๋๋ฉด ์ด์ ๋ํ ํฌํฌ ๋ณ๊ฒฝ์ ์งํํด์ผํฉ๋๊น?
์๋
ํ์ธ์. ์ฐ๋ฆฌ๋ ๋ํ ์ต์ ์ผ๋ก ์
๋ฐ์ดํธ 7.1.1
์ @types/react-redux
ํฌํจ ๋ ๋ฒ์ react-redux
: 7.1.0
์ฐ๋ฆฌ๋ NPM์ด ์ค๋ฅ๋ฅผ๋ณด๊ณ ์๋ค. ์ด๊ฒ์ ์ธ๊ธํ๋ ๋ชจ๋ ํฐ์ผ์ด ๋ง๊ฐ๋์ด ํผ๋์ค๋ฝ์ต๋๋ค.
7.0.1
๋ค์ด๊ทธ๋ ์ด๋ํ๋ฉด ์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง๋ง ์ต์ Typescript ๋ฒ์ 3.5.x
์ฌ์ฉํ๋ฉด ์๋ก์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
/.../node_modules/@types/react-redux/index.d.ts(109,84): error TS2344: Type 'GetProps<C>' does not satisfy the constraint 'Shared<TInjectedProps, GetProps<C>>'.
Type 'unknown' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
Type 'Matching<TInjectedProps, GetProps<C>>' is not assignable to type 'Shared<TInjectedProps, GetProps<C>>'.
Type 'P extends keyof TInjectedProps ? TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : TInjectedProps[P] : GetProps<C>[P]' is not assignable to type 'TInjectedProps[P] extends GetProps<C>[P] ? GetProps<C>[P] : never'.
์ข ์ฌํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก ๋ง๋ญ๋๋ค.
@types/react-redux
์ ์ต์ ๋ฒ์ (์: 7.1.1
)์ @types/react-redux
Shared<TInjectedProps, GetProps<C>>
๋ฅผ ์ ์ฝ ์กฐ๊ฑด์ผ๋ก ์ฌ์ฉํ์ง ์์ต๋๋ค (์ ํํ ์ ์ฝ ์กฐ๊ฑด์ด ์๋ชป๋์์์ ์ง์ ํ TS์ ์์ ์ฌํญ ๋๋ฌธ). - react-redux
์ ํ์ ์ด์ ๋ฒ์ ์ ์ค์ฒฉ ํฌํจ์ ๊ฐ์ ํ๋ ๋ ๋ค๋ฅธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
๊ทธ๋์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค. "ํจ์น ํจํค์ง"๋ผ๊ณ ํฉ๋๋ค.
ํจ์น ํจํค์ง๋ฅผ ์ฌ์ฉํ์ง ์์๋ค๋ฉด ์ค์ ๋ก ๋งค์ฐ ์ฝ์ต๋๋ค! ๊ตฌ์ฑ์ ์ถ๊ฐํ๊ณ npm์ผ๋ก ์ค์นํ ๋ค์ ์์ ํ๊ณ ์๋ ์ค์ธ ๋ณ๊ฒฝ๋ ๋ชจ๋์์ ํจ์น ํจํค์ง ๋ช ๋ น์ ๋๋ฅด๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค. ์ด์ ์์ ํ ๋ชจ๋์ ๋ณ๊ฒฝ๋ ํ์ผ๋ง ์๊ณ ๋๋ฌด ํ๋ คํ๊ฑฐ๋ ๋๋ฌด ํฐ ๋ฑ์ ์๋ ํจ์น ํจํค์ง ์๋์ ์๋ ๋ช ๊ฐ์ ๋ชจ๋์ด ์์ต๋๋ค. ์ค๋ฅ๊ฐ ์์ ๋๊ณ ์ข ์์ฑ์ด ์์ค๋์ง ์์ผ๋ฏ๋ก ์์ ๋ ๋ ํ๋ ๋๋ ๋ ๊ฐ์ ํ์ผ์ ์ฝ๊ฒ ์ญ์ ํ ์ ์์ผ๋ฉฐ ๋ชจ๋ ๊ด์ฐฎ์ต๋๋ค.
hoist-non-react-statics
๋ฅผ ์ค์นํ๋ฉด react-redux
7.1.0 ๋ฐ @types/react-redux
7.1.1์ ๋ํ ์ด ์ค๋ฅ๊ฐ ํด๊ฒฐ๋๋ค๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค. ์ ๋ Typescript 3.4.3๋ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
๊ทธ๋ฐ๋ฐ ์ ์ด ๋ฌธ์ ๊ฐ ์ข ๋ฃ๋์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ํจํค์ง๋ฅผ ํจ์นํ๊ฑฐ๋ ๋ชจ๋ ํ์ธ ํธ๋ฆฌ๋ฅผ ์ฌ์ ์ํ์ง ์๊ณ ๋ ๋ ํฉ๋ฆฌ์ ์ธ ์๋ฃจ์ ์ด ์์ต๋๊น?
@jalMogo ์ ๊ฐ์ ๋ฌธ์ ๊ฐ
์ด ๋ฌธ์ ๊ฐ ๊ณ์ ํ์๋ฉ๋๋ค.
@jalMogo ๋ด๊ฐ ์ดํดํ๋ ํ ์ด๊ฒ์ redux์ ๋ฌธ์ ๊ฐ ์๋๋ผ hoist-non-react-statics์ ๋ฌธ์ ์ด๋ฏ๋ก ์ฌ๊ธฐ์์ ๋ฌธ์ ๋ฅผ ์ข ๊ฒฐํฉ๋๋ค. ์ค๋ ๋์๋ ์ฌ๋ฌ ๊ฐ์ง ํด๊ฒฐ ๋ฐฉ๋ฒ์ด ์์ง๋ง ์๋ จ ๋ ์ฌ๋์ด ํธ์ด์คํธ ์ฌ๋๋ค์๊ฒ ์์ ์ฌํญ์ ์ ๊ณตํ๋ฉด ๋ ์ข์ต๋๋ค.
๋๋ ๊ทธ๊ฒ์ด ํธ์ด์คํธ-๋น๋ฐ์-์ ์ญํ์ ๋ฌธ์ ๋ผ๋ ๋ฐ ๋์ํ์ง ์์ต๋๋ค. ์ด๊ฒ์ node_modules ํธ๋ฆฌ์ ์กด์ฌํ๋ ๊ฒฝ์ฐ hoist-non-react-statics์ ์ด์ ๋ฒ์ ๊ณผ ์๋ชป๋ ๋ฒ์ ์ ๋ณด๊ฒ ๋๋ค๋ ์ ์์ redux์ ๋ํ ์ค๋ช ์ ๋ฌธ์ ์ ๋๋ค. ๋ผ์ฐํฐ์ ๊ฐ์ ๋ค๋ฅธ ํญ๋ชฉ์ด ์ค์น๋ ๋ ์ํ๋ฉ๋๋ค. . ์ข ์์ฑ์ ์ ์ ํ๊ฒ ์ค๋ช ํ๊ณ ์ ๋ฒ์ ์ node_modules ํธ๋ฆฌ์ ๋ ๊ฐ๊น๊ฒ ์ ์ ํ๊ฒ ์ค์นํด์ผ ํฉ๋๋ค.
์ด๊ฒ์ ์ฌ์ ํ โโ๋ฌธ์ ์ ๋๋ค.
+1
์ฌ์ ํ ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ณ ์ฝ๋์ ์ค๋ฅ๊ฐ ์๋ค๊ณ ๋ฆฐํธ๊ฐ ํ์๋ฉ๋๋ค. ์์ง ์ด ์์ ์ ํ๊ณ ์๊ฑฐ๋ ํ์๋ ๊ฒ์ผ๋ก ๊ฐ์ฃผ๋๋ ์ฌ๋์ด ์์ต๋๊น? ์ต์ ๋ฒ์ ์ด ๋ชจ๋ ์ค์น๋์ด ์๋๋ฐ๋ ์ฌ์ ํ ๋ค์์ ์ป์ต๋๋ค.
๋ค์์คํ์ด์ค '"/home/myhome/Projects/node_modules/hoist-non-react-statics/index"' ๋ด๋ณด๋ธ ๋ฉค๋ฒ 'NonReactStatics'.ts(2694)๊ฐ ์์ต๋๋ค.
์ด๊ฒ์ ํ์คํ ๊ทธ๋ค์ ๋ฌธ์ ์
๋๋ค. ํด๊ฒฐ ๋ฐฉ๋ฒ: @types/hoist-non-react-statics
๊ฐ ์๋ํ๋ ค๋ฉด ํ๋ก์ ํธ์ ์ข
์์ฑ์ผ๋ก ๋์ด๋์ด์ผ ํฉ๋๋ค.
๊ทธ๋ฌ๋ ๋๋ ๊ทธ๊ฒ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ ์ฌ์ ํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
"์ข
์์ฑ": {
...
"@types/hoist-non-react-statics": "^3.3.1",
๋ด package.json์ ์์ต๋๋ค
๋ด ์๋ชป์ด์ผ. hoist-non-react-statics
๋ณด๋ธ ์ฌ๋: Robert Rehammar [email protected]
๋ณด๋ธ ๋ ์ง: 2019๋
10์ 20์ผ ์ผ์์ผ ์ค์ 1:50:51
๋ฐ๋ ์ฌ๋: ConfirmTyped/DefinitelyTyped ํ์คํ๊ฒ[email protected]
์ฐธ์กฐ: wolfy1339 [email protected] ; ๋ฉ์
@noreply.github.com
์ ๋ชฉ: Re: [DefinitelyTyped/DefinitelyTyped] [@types/react-redux] 'hoist-non-react-statics'์ ๋ด๋ณด๋ธ ๋ฉค๋ฒ 'NonReactStatics'๊ฐ ์์ต๋๋ค(#33690).
๊ทธ๋ฌ๋ ๋๋ ๊ทธ๊ฒ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ ์ฌ์ ํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
"์ข
์์ฑ": {
...
"@types/hoist-non-react-statics": "^3.3.1",
๋ด package.json์ ์์ต๋๋ค
โ
๋น์ ์ด ์ธ๊ธ๋์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์
๋๋ค.
GitHub์์ ๊ทธ๊ฒ์ ์ง์ ์ด ์ด๋ฉ์ผ์ ํ์ ๋ณผ https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33690?email_source=notifications&email_token=ABDB6FORFBHI575QMINWIQ3QPPWTXA5CNFSM4G4MRVM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBYC7IY#issuecomment-544223139 , ๋๋ ํํด https://github.com/notifications/unsubscribe- ์ธ์ฆ/ABDB6FLBLRAIO2PIIGMMJY3QPPWTXANCNFSM4G4MRVMQ .
๋ด ์์กด์ฑ์๋ "hoist-non-react-statics": "^3.3.0"
"@types/hoist-non-react-statics": "^3.3.1"
๊ฐ ์๊ณ devDependencies์๋
๋ํ ๋ช
์์ ์ผ๋ก "@types/hoist-non-react-statics"
์ค์นํ์ง ์๊ณ ์๋ํ์ง๋ง(๋ด๊ฐ ์ดํดํ ๋ฐ์ ๋ฐ๋ฅด๋ฉด ๊ธฐ๋ณธ ํจํค์ง์๋ ์ด๋ฏธ ์
๋ ฅ์ด ํฌํจ๋์ด ์์ด์ผ ํจ) ๊ฒฐ๊ณผ๋ ๋์ผํฉ๋๋ค.
์ด ๋ฌธ์ ์ ์ง๋ฉดํ ์ฌ๋์ ์คํ ๊ฐ๋ฅํ ์ฌ์์ฐ์ ์ ๊ณตํด์ผ ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ๋์์ ๋๋ฆด ์ ์์ต๋๋ค.
์ฃ์กํฉ๋๋ค. ์ ๊ฐ ๊ฒช๊ณ ์๋ ํ๋ก์ ํธ๋ ์คํ ์์ค๊ฐ ์๋๋ฉฐ ์ด๋ฅผ ์ ๋ณด์ผ ๋ณ๋์ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค ์๊ฐ์ด ์์ต๋๋ค. ๋ด๊ฐ ๊ทธ๋ฌ๋ ํต์ง๋ฅผ ํ ์ผ์ I๊ฐ ํ์ฑํ ๋ ๋๊น์ง ํ๋ก์ ํธ๊ฐ ๋ ๋ฌธ์ ๊ฐ ์์๋ค์
๋๋ค allowJs: true
์ tsconfig.json
. ์ด ์ค์ ์ด ์์ผ๋ฉด ๋ชจ๋ ๊ฒ์ด ์ฌ์ ํ ์ ์๋ํ์ต๋๋ค. ๋์์ด ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
'hoist-non-react-statics'๋ฅผ ์ถ๊ฐํ๋ฉด ์ฌ๊ธฐ์์ ํด๊ฒฐ๋ ๊ฒ ๊ฐ์ต๋๋ค.
repro๋ @types/react-redux๋ฅผ ์ค์นํ ๋ค์ react-redux์ ๋ชจ๋ ๊ฒ์ tsx ํ์ผ๋ก ๊ฐ์ ธ์ค๋ ๊ฒ์ ๋๋ค.
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ tsconfig.json์ "skipLibCheck": true๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ ๋๋ค. ์ต์์ ์๋ฃจ์ ์ ์๋์ง๋ง ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค.
typescript๊ฐ ๋ค์ ์์๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ๋๋ฌธ์ ์ด๋ฐ ์ผ์ด ๋ฐ์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
package/package.json[types]
@types/package
package
( types
ํ๋๋ฅผ ์ ์ธํ ๋ชจ๋ ํญ๋ชฉ)์ ๊ทธ๋ ๊ฒ ํ๋์ง๋ ๋ฏธ์คํฐ๋ฆฌ์ง๋ง ์ฌ๊ธฐ์ ๋ฌธ์ํ๋์ด ์์ต๋๋ค. https://www.typescriptlang.org/docs/handbook/module-resolution.html#how -typescript-resolves-modules
์๋ฅผ ๋ค์ด ๋ค์ ๋๋ ํ ๋ฆฌ ๊ตฌ์กฐ๊ฐ ์๋ ๊ฒฝ์ฐ:
node_modules/
@types/
hoist-non-react-statics/ (3.3.0)
react-redux/
node_modules/
hoist-non-react-statics/ (3.3.0)
hoist-non-react-statics/
package.json (2.0, which has a types field!!!)
index.d.ts
๊ทธ๋ฐ ๋ค์ typescript๋ ๋ค์์ ์ํํฉ๋๋ค.
node_modules/@types/react-redux/node_modules/hoist-non-react-statics
์์ ์ ํ์ ๊ฐ์ ธ์ค์ง ๋ชปํ์ต๋๋ค.package.json
์ types
ํ๋๊ฐ ์๊ธฐ ๋๋ฌธ์ node_modules/hoist-non-react-statics
(์ด์ ๋ฒ์ )์์ ์ ํ์ ์ฐพ๋ ๋ฐ ์ฑ๊ณต๋ค๋ฅธ ์ฌ๋๋ค์ ์ต์ ์ ํ๋ก์ ํธ์ ์ข
์์ฑ์ ์ถ๊ฐํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ต๋๋ค ์ธ๊ธ ํ ๋ฐ๋ผ์์ผ๋ก hoist-non-react-statics
๊ทธ๊ฐ ์๊ธฐ ๋๋ฌธ์, types
ํ๋ package.json
๊ทธ๋ ๊ฒ 2๋จ๊ณ๋ฅผ ์คํจํ๊ฒ ๋ง๋ญ๋๋ค.
์์ด๋ฌ๋ํ๊ฒ๋ ํ๋ก์ ํธ์ ์ด์ hoist-non-react-statics
์ ์ข
์์ฑ์ ์ถ๊ฐํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์๋ ์์ต๋๋ค(์: 3.0.0). ์ด๊ฒ์ ์ฌ๋ฐ๋ฅธ ๋ฒ์ (3.3.0)์ node_modules/@types/react-redux/node_modules/types/hoist-non-react-statics
๊ฐ์ ๋ก ์ค์นํ๊ธฐ ๋๋ฌธ์ ์๋ํฉ๋๋ค. ์ฌ๊ธฐ์ ์ด์ ์ ํด๊ฒฐ๋์์ต๋๋ค.confounded:
๋ ๊ฐ์ง ์ง๋ฌธ์ด ์์ต๋๋ค.
types
ํ๋๋ฅผ ์ด๋ฐ ์์ผ๋ก ํน๋ณํ ์ฒ๋ฆฌํ๊ณ types
ํ๋์ ์ฌ์ฉ ์ฌ๋ถ์ ๋ฐ๋ผ @types
ํจํค์ง ์์ด๋ ๋ค์ ์ต๋๋ค.hoist-non-react-statics
ํ ๋ฒ ์ ํ์ด ๋ด์ฅ๋์ด ์์๋ค๋ฉด ์ ์ฌ๊ธฐ์์ ์ ์ธ๋์์ต๋๊น? ์ ํ์ด ํจํค์ง์ ๋ด์ฅ๋์ด ์์ผ๋ฉด ๋ฌธ์ ๊ฐ ๋์ง ์์ต๋๋ค. ๋ ๊ฐ์ ์ฐ๊ฒฐ ๋ฐฉ๋ฒ์ ๋ชจ๋ฅด๊ธฐ ๋๋ฌธ์ yarn/NPM์ด ์ฝ๋ ๋ฐ ์ ํ์ ๋ํ ๋ณ๋์ ํจํค์ง๋ฅผ ์ด๋ป๊ฒ ์ ์ ํ๊ฒ ์ฒ๋ฆฌํ ์ ์๋์ง ์ ์ ์์ต๋๋ค.์ด ๋ฌธ์ ๋ ์ต์ ํจํค์ง ๋ฒ์ ์์ ๋ค์ ๋ํ๋ฌ์ต๋๋ค. ์:
[email protected]
@types/[email protected]
package.json
๋ค์ ํจํค์ง๋ฅผ ์๋์ผ๋ก ํฌํจํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๋ค.
[email protected]
@types/[email protected]
๋ด ์ด๊ธฐ npm install
์ดํ์ hoist-non-react-statics
ํจํค์ง ๋๋ฌธ์ ๋ด node_modules
ํด๋์ ์ด๋ฌํ ํจํค์ง์ ์ค๋ณต์ด ์์์ต๋๋ค. npm dedupe
ํ๋ฉด ํด๊ฒฐ๋ฉ๋๋ค.
ํจ๊ป ์ค์๋ ๋ค๋ฅธ ๋ถ๋ค๊ป ๋์์ด ๋๊ธธ ๋ฐ๋๋๋ค!
์ด ๋ฌธ์ ๋ ์์์ต๋๋ค. @DannyDelott ์ ์๋ฃจ์ ์ ์ฐฌ์ฌ๋ฅผ
์ด ๋ฌธ์ ๋ ์์์ต๋๋ค. @DannyDelott ์ ์๋ฃจ์ ์ ์ฐฌ์ฌ๋ฅผ
์ง์ ์ ์ผ๋ก ํ์ํ์ง ์์ ์ข
์์ฑ์ผ๋ก package.json
์ ์ค์ผ์ํค์ง ์๊ณ ํ์ฌ๋ก์๋ ๊ฐ์ฅ ๋น ๋ฅธ ํด๊ฒฐ์ฑ
์ @types/react-redux
๋ฅผ ์ ๊ฑฐํ๋ ๊ฒ์
๋๋ค.
npm remove @types/react-redux
์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ ๊ฒ์ผ๋ก ํ์ธ๋๋ฉด ๋ค์ ๋๋๋ฆด ์ ์์ต๋๋ค.
๋ฌธ์ ๊ฐ ๊ณ์ ๋ฐ์ํ๊ณ ์์ผ๋ฉฐ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ์ ์ผํ ๋ฐฉ๋ฒ์ ์ธ๊ธ๋ ์ข ์์ฑ์ ํ๋ก์ ํธ์ ์ถ๊ฐํ๋ ๊ฒ์ ๋๋ค. ์ด๊ฒ์ ์ด์์ ์ด์ง ์์ผ๋ฏ๋ก ๊ณง ์์ ๋ ๊ฒ์ ๋๋ค!
์ฌ์ ํ ์ด ๋ฌธ์ ๋ฅผ ์ธ์งํ๊ณ ์์ต๋๋ค.
์์ ์ ์ธ ์์ ์ด ์ ๊ณต๋๋ ๋์ ๊ณ์ ๊ฐ๋ฐํ๋ ค๋ ์ฌ๋์ ์๋์ typedef๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
// [your-src-folder]/types/hoist-non-react-statics.d.ts
declare module 'hoist-non-react-statics' {
type NonReactStatics<T> = any;
export { NonReactStatics }
}
์ด๊ฒ์ ์ด์์ ์ธ ์๋ฃจ์ ์ ์๋์ง๋ง ์ ์ด๋ TS์์ ๋น๋ ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๋ ๋ฐ ์ ์ฉํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋ด๊ฐ ํ๋ฆด ์๋ ์์ง๋ง ๋ฌธ์ ๊ฐ ๋ ๊ฐ๋จ ํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
ํด์ผํ๋ค
@types/react-redux 7.0.1๋ก ๋ค์ด๊ทธ๋ ์ด๋ํ๋ ๊ฒ์ ์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ ๋๊น์ง ๋น ๋ฅธ ์์ ์ ๋๋ค.