์๋ ํ์ญ๋๊น,
๋ฉฐ์น ์ ๋ถํฐ @types/lodash-es ๋ฐ lodash-es๋ฅผ ์ฌ์ฉํ์ฌ ๊ธฐ์กด Angular2+ ํ๋ก์ ํธ๋ฅผ ๋น๋ํ๋ ค๊ณ ํ ๋ ๋ค์์ด ํ์๋๊ธฐ ์์ํ์ต๋๋ค.
.../node_modules/@types/lodash/common/object.d.ts (): Cannot find name 'Exclude'.
์ด๋ก ์ธํด ํ๋ก๋์
๋น๋๊ฐ ๋ ์ด์ ์ฑ๊ณต์ ์ผ๋ก ์๋ฃ๋์ง ์์ต๋๋ค.
ํ๋ก์ ํธ๋ ๋ค์์ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
"@types/lodash-es": "^4.14.5",
"lodash-es": "^4.17.4",
"typescript": "~2.3.2"
https://github.com/lodash/lodash/issues/4225 ๋ฐ https://stackoverflow.com/questions/55018665/following-lodash-error-on-build-cannot-find-name-exclude ์ ๋ฐ๋ฅด๋ฉด Typescript 2.8+์ ์์กดํ๋ ๋ณ๊ฒฝ ์ฌํญ์ด ์์์ต๋๋ค.
typescript ๋ฒ์ ์ 2.3 ์ด์์ผ๋ก ์ ๋ฐ์ดํธํ ํ์๊ฐ ์๋ ์ ๋ฐ์ดํธ๋ฅผ ์ ๊ณตํ ์ ์์ต๋๊น?
๋ด๊ฐ ๋ณด๊ธฐ์๋ package-lock.json ํ์ผ์์ "@types/lodash": "*"๊ฐ ํ์ํ @types/lodash-es๋ก ์ธํด ๋ฌธ์ ๊ฐ ๋ฐ์ํ ๊ฒ์ผ๋ก ๋ณด์ ๋๋ค. ๊ทธ ๊ฒฐ๊ณผ package-lock.json ํ์ผ์ ๋ค์ ํญ๋ชฉ์ด ์์ฑ๋ฉ๋๋ค.
"@types/lodash": {
"version": "4.14.123",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.123.tgz",
},
๋ฒ์ 4.14.123์๋ ์ฃผ์ ๋ณ๊ฒฝ ์ฌํญ์ด ํฌํจ๋์ด ์์ต๋๋ค(Typescript 2.8 ์ด์์์๋ง ์ฌ์ฉํ ์ ์๋ ์ ์ธ ์ฌ์ฉ).
ํ๋ก์ ํธ์์ ์ต์ ๋ฒ์ ์ @types/lodash๋ฅผ ๊ฐ์ ธ์ค๊ฑฐ๋ ์ฌ์ฉํ์ง ์๋ @types\lodash-es ๋ฒ์ ์ ์ด๋ป๊ฒ ์ฌ์ฉํ ์ ์์ต๋๊น?
๋ด ์ง๋ฌธ์ ์์ธํ ๋ด์ฉ์ด ๋์ ์์ต๋๋ค. https://stackoverflow.com/questions/55123747/lodash-es-error-on-build-cannot-find-name-exclude
๋ด๊ฐ ๋ณด๊ธฐ์๋ ์ด์ ๋ฒ์ ์ @types/lodash-es๊ฐ @types/lodash์ ๊ฐ์ฅ ์ต๊ทผ ๋ฒ์ ์ ํ๋ก์ ํธ์ ๊ฐ์ ธ์ค๋ ์์ธ์ด ๋๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ฆ, @types/lodash 4.14.123์ด Typescript 2.3.*๊ณผ ํธํ๋์ง ์์ต๋๋ค(Exclude๊ฐ ์ฌ์ฉ๋๊ธฐ ๋๋ฌธ์). ๊ทธ๋ฌ๋ ๋ด๊ฐ ํ๋ก์ ํธ์์ ๊ฐ์ง๊ณ ์๋ ์ ์ผํ ๊ด๋ จ ์ข ์์ฑ์ธ @types/lodash-es๊ฐ ๊ฐ์ ์ ์ผ๋ก ์ฒ๋ฆฌ๋๊ธฐ ๋๋ฌธ์ @types/lodash์ ์ด๋ค ๋ฒ์ ์ด ํ์ํ์ง ์ ์ดํ ์ ์์ต๋๋ค...
ํจํค์ง.json
{
"์ด๋ฆ": "ํ
์คํธ",
"๋ฒ์ ": "0.0.0",
"๋ผ์ด์ผ์ค": "MIT",
"์คํฌ๋ฆฝํธ": {
"ng": "ng",
"์์": "ng ์๋ธ",
"๋น๋": "ng ๋น๋",
"ํ
์คํธ": "ng ํ
์คํธ",
"๋ฆฐํธ": "ng ๋ฆฐํธ",
"e2e": "ng e2e",
"bundle-report": "webpack-bundle-analyzer dist/stats.json"
},
"๋น๊ณต๊ฐ": ์ฌ์ค,
"์ข
์์ฑ": {
"@angular/animations": "^4.2.5",
"@๊ฐ๋/๊ณตํต": "^4.2.5",
"@๊ฐ๋/์ปดํ์ผ๋ฌ": "^4.2.5",
"@angular/compiler-cli": "^4.2.5",
"@๊ฐ๋/์ฝ์ด": "^4.2.5",
"@angular/forms": "^4.2.5",
"@angular/http": "^4.2.5",
"@angular/platform-browser": "^4.2.5",
"@angular/platform-browser-dynamic": "^4.2.5",
"@๊ฐ๋/๋ผ์ฐํฐ": "^4.2.5",
"@asymmetrik/ngx-leaflet": "2.6.1",
"@asymmetrik/ngx-leaflet-draw": "2.7.1",
"@types/angular-ui-bootstrap": "^0.13.44",
"@types/fullcalendar": "^3.5.0",
"@types/googlemaps": "^3.26.14",
"@types/highcharts": "^5.0.36",
"@types/jquery": "^2.0.46",
"@types/jqueryui": "^1.11.35",
"@types/๋ฆฌํ๋ฆฟ": "1.2.7",
"@types/leaflet-draw": "0.4.12",
"@์ ํ/์๊ฐ": "^2.13.0",
"@์ ํ/๋
ธ๋": "^6.0.79",
"@ultimate/ngxerrors": "^1.3.0",
"angular2-๊ฐ์ ์คํฌ๋กค": "^0.3.1",
"babel-regenerator-runtime": "^6.5.0",
"๋ถํธ์คํธ๋ฉ": "^3.3.7",
"core-js": "^2.4.1",
"๋๋ผ๊ตด๋ผ": "^3.7.2",
"๋ฉ์ง ๊ธ๊ผด": "^4.7.0",
"์ ์ฒด ๋ฌ๋ ฅ": "^3.6.2",
"fullcalendar-์ค์ผ์ค๋ฌ": "^1.9.3",
"ํ์ด์ฐจํธ": "6.2.0",
"jquery": "^3.2.1",
"jquery-ui-sortable": "^1.0.0",
"jqueryui": "^1.11.1",
"๋ฆฌํ๋ฆฟ": "1.3.1",
"๋ฆฌํ๋ฆฟ ๊ทธ๋ฆฌ๊ธฐ": "1.0.2",
"๋ก๋ค์ฌ": "^4.17.4",
"์๊ฐ": "^2.18.1",
"์๊ฐ-์๊ฐ๋": "^0.5.14",
"ng-treetable": "^1.2.3",
"ng2-ckeditor": "1.1.9",
"ng2-dragula": "^1.5.0",
"ng2-pdf-viewer": "3.0.8",
"ngx-๋ถํธ์คํธ๋ฉ": "^1.9.1",
"ngx ์ฟ ํค ์๋น์ค": "^1.0.10",
"ngx-malihu-์คํฌ๋กค๋ฐ": "^1.1.2",
"ngx-ํ์ดํ": "~1.6.1",
"ngx-restangular": "^1.0.11",
"ngx-slick": "^0.1.3",
"ํ๋ผ์": "4.2.2",
"rxjs": "^5.1.0",
"slick-carousel": "^1.8.1",
"socket.io-client": "^2.0.4",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "^1.7.4",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/๋ฆฌํ๋ฆฟ": "1.2.7",
"@types/leaflet-draw": "0.4.12",
"@์ ํ/๋
ธ๋": "~6.0.60",
"codelyzer": "~2.0.0",
"์ฌ์ค๋ฏผ ์ฝ์ด": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"์นด๋ฅด๋ง": "~1.4.1",
"์นด๋ฅด๋ง ํฌ๋กฌ ์คํ๊ธฐ": "~2.1.1",
"์นด๋ฅด๋ง-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"์นด๋ฅด๋ง ์ฌ์ค๋ฏผ": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"๊ฐ๋๊ธฐ": "~5.1.0",
"ts-๋
ธ๋": "~2.0.0",
"tslint": "~4.5.0",
"ํ์
์คํฌ๋ฆฝํธ": "2.3.4",
"์นํฉ ๋ฒ๋ค ๋ถ์๊ธฐ": "^2.9.0"
}
}
๋จ๊ณ:
/../node_modules/@types/lodash/common/object.d.ts์ ์ค๋ฅ(1689,12): '์ ์ธ' ์ด๋ฆ์ ์ฐพ์ ์ ์์ต๋๋ค.
/../node_modules/@types/lodash/common/object.d.ts์ ์ค๋ฅ(1766,12): '์ ์ธ' ์ด๋ฆ์ ์ฐพ์ ์ ์์ต๋๋ค.
/../node_modules/@types/lodash/common/object.d.ts์ ์ค๋ฅ(1842,34): '์ ์ธ' ์ด๋ฆ์ ์ฐพ์ ์ ์์ต๋๋ค.
์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์ด๊ฑฐ ํด๊ฒฐ ๋ฐฉ๋ฒ ์๋์??
ํ์ผ("/../node_modules/@types/lodash/common/object.d.ts")์ " https://codeshare.io/adWzlB " ์ฝ๋๋ก ๋ฐ๊พธ๋ฉด ์๋ํฉ๋๋ค...
๋น์ทํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ @types/lodash์ "4.14.121" ๋ฒ์ ์ ์ค์นํ์ผ๋ฉฐ ๋ ์์ ์ ์ธ ๋ฒ์ ์ผ๋ก ๋ณด์ด๊ณ ๋ด๊ฐ ์ค์นํ typescript ๋ฒ์ ๊ณผ ํธํ๋๋ ๊ฒ์ผ๋ก ์ ์๋ํฉ๋๋ค.
์ข ์์ฑ์ ๋ด package.json ํ์ผ์์ ์๋์ ๊ฐ์ต๋๋ค.
"์ข
์์ฑ": {
...........................,
"@types/lodash": "4.14.121",
"ํ์ดํ์คํฌ๋ฆฝํธ": "2.5.3",
}
npm ํ๊ทธ๋ฅผ ์ฌ์ฉํ์ฌ ์ด์ ๋ฒ์ ์ typescript์ ๋ํ ์ ํ์ ์ค์นํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด typescript 2.5 npm i -D @types/[email protected]
๋ํ lodash ์ ํ์
๋๋ค.
๋ฐฉ๊ธ typescript@~2.8.x
์
๋ฐ์ดํธํ๊ณ ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค!
@elouizbadr typescript@~2.8.x
์
๊ทธ๋ ์ด๋ํ ํ ๋น๋ ์๋๊ฐ ๋๋ ค์ก ์ต๋๊น? ๋น๋ ์๊ฐ์ด ๋๋ฌด ์ค๋ ๊ฑธ๋ฆฌ๋ฉฐ 2.8.x๋ก ์
๊ทธ๋ ์ด๋ํ ํ ๊ฑฐ์ ๋ ๋ฐฐ ๋๋ ค์ง๋๋ค.
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์๊ณ @faizu88 ๋จ๊ณ๋ฅผ ๋ฐ๋๊ณ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค.
๊ฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ด ์๋ฃจ์ ์ ๋ช ๋ น ์๋์์ ์คํ๋ฉ๋๋ค.
CD ์ฑ
npm install @types/ lodash @
ํฌ๋ง์ ๋ง์ ์ฌ๋์ ๋์ธ ์ ์์ต๋๋ค. :)
์ด๊ฒ์ ๋๋ฅผ ์ํด ์ผํ์ต๋๋ค : https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33778#issuecomment -473358843 by @j-oliveras
์ด ๊ฒฝ์ฐ ๋์ผํ ๋ฒ์ ์ nodejs๋ฅผ ์ฌ์ฉํ๋ ํ์์ ์ผํ ๋ ์ง๋ฉดํ๊ณ
npm. ๋์ผํ ์์ค ์ฝ๋๋ก ๋น๋ํ ์ ์๊ณ ๋ด ์น๊ตฌ dun์๊ฒ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
node_module์ ํ์ธํ๊ณ lodash๋ฅผ ๋น๊ตํ ๋. ๋๋ ๋ฒ์ ์ด
๋ค๋ฅธ. ์ฌ๋ฐ๋ฅธ ๋ฒ์ ์ 4.14.116์
๋๋ค.
2019๋
5์ 20์ผ ์์์ผ ์คํ 10์ 41๋ถ Toby Thain [email protected]
์ผ๋ค:
์ด์ ๋ํ ๋ช ํํ ์ค๋ช ๊ณผ ํฉ๋ฆฌ์ ์ธ ํด๊ฒฐ์ฑ ์ด ์์ต๋๊น?
โ
๋น์ ์ด ๋๊ธ์ ๋ฌ์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์ ๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ณ GitHub์์ ํ์ธํ์ธ์.
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33778?email_source=notifications&email_token=AELTPL2WSZ6YGC5FNLAIF3TPWLBEJA5CNFSM4G5FWYT2YY3PNVWWK3TUL52HS4DFVEXG43
๋๋ ์ค๋ ๋ ์์๊ฑฐ
https://github.com/notifications/unsubscribe-auth/AELTPL3O5YGZXAHUDSEBN3TPWLBEJANCNFSM4G5FWYTQ
.
npm i -D @types/ [email protected]
์ด ๋ช ๋ น์ ์ ์๊ฒ๋ ํจ๊ณผ์ ์ด์์ต๋๋ค.
๋ฐฉ๊ธ
typescript@~2.8.x
์ ๋ฐ์ดํธํ๊ณ ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค!
typescript@~2.8.2๋ฅผ ์ค์ ํ๋๋ฐ ์๋ํฉ๋๋ค!! ๊ฐ์ฌํฉ๋๋ค !!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
npm ํ๊ทธ๋ฅผ ์ฌ์ฉํ์ฌ ์ด์ ๋ฒ์ ์ typescript์ ๋ํ ์ ํ์ ์ค์นํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด typescript 2.5
npm i -D @types/[email protected]
๋ํ lodash ์ ํ์ ๋๋ค.