Definitelytyped: LoDashExplicitArrayWrapperμ—μ„œ Lodash 일뢀 λ©”μ„œλ“œκ°€ λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2015λ…„ 11μ›” 03일  Β·  50μ½”λ©˜νŠΈ  Β·  좜처: DefinitelyTyped/DefinitelyTyped

TypeScript μ½”λ“œ(https://lodash.com/docs#chainμ—μ„œ):

var users = [
    { 'user': 'barney',  'age': 36 },
    { 'user': 'fred',    'age': 40 },
    { 'user': 'pebbles', 'age': 1 }
];

var youngest = _.chain(users)
    .sortBy('age')
    .map(function(chr) {
        return chr.user + ' is ' + chr.age;
    })
    .first()
    .value();

tsc 컴파일러 뢈만 사항:

error TS2339: Property 'sortBy' does not exist on type 'LoDashExplicitArrayWrapper<{ 'user': string; 'age': number; }>'.

pluck λ§ˆμ°¬κ°€μ§€μž…λ‹ˆλ‹€.

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

ν•΄κ²° 방법은 λ‹€μŒκ³Ό 같을 수 μžˆμŠ΅λ‹ˆλ‹€.

(lodash.chain(stuff).pickBy(lodash.isArray) as any).transform(transformFunction, []).value();

λͺ¨λ“  50 λŒ“κΈ€

예, μž‘μ—… 쀑이며 μ–΄λ–€ 방법이 ν₯λ―Έλ‘œμš΄μ§€ μ μ–΄μ£Όμ‹œλ©΄ λ¨Όμ € μΆ”κ°€ν•˜κ² μŠ΅λ‹ˆλ‹€.

by #6600 :+1:

error TS2339: Property 'first' does not exist on type 'LoDashExplicitArrayWrapper<string>'.

@joe-chung λ„€, λͺ¨λ“ˆ μ •μ˜μ— λͺ‡ 가지 λ¬Έμ œκ°€ 있으며 μ§€κΈˆ λ‹Ήμž₯ first (및 일뢀 λ‹€λ₯Έ 방법)에 μ„œλͺ…을 μΆ”κ°€ν•˜κΈ° μ–΄λ ΅κ²Œ λ§Œλ“­λ‹ˆλ‹€.

Property 'some' does not exist on type 'LodashArrayWrapper<any[]>'

@thakursagar μΈν„°νŽ˜μ΄μŠ€ LodashArrayWrapper 의 μ •μ˜μ— μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” lodash 였랜 μ‹œκ°„ λ™μ•ˆ. μ΅œμ‹  λ²„μ „μ˜ μ •μ˜λ₯Ό μ‚¬μš©ν•˜κ³  μžˆλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€. some λ©”μ„œλ“œλŠ” 이미 잘 μž‘λ™ν•©λ‹ˆλ‹€.

LoDashExplicitArrayWrapperμ—μ„œ _.reduce에 λŒ€ν•œ PR을 μ œμΆœν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ? 이것은 μš°λ¦¬μ—κ²Œ 도움이 될 κ²ƒμž…λ‹ˆλ‹€

@gamebox 예,

_.uniqBy 도 ν•„μš”ν•©λ‹ˆλ‹€

λ˜ν•œ _.flattenDepth()

및 _.sort

그리고 _.λΆ„ν• 

_.flatMap μ£Όμ„Έμš”

@chrootsu _.update 및 _.updateWith λΆ€νƒλ“œλ¦½λ‹ˆλ‹€ :)

속성 'mean'은 'LoDashStatic' μœ ν˜•μ— μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

_(x).split을 μΆ”κ°€ν•˜μ„Έμš”.

λ™μΌν•œ 문제: Property 'split' does not exist on type 'LoDashExplicitWrapper<string>'

λ‘œλ“œμ‹œ 버전: 3.10.1

타이핑.json 쒅속성:
"lodash": "registry:dt/lodash#3.10.0+20160802150749"

_.keyBy 도 λˆ„λ½λœ 것 κ°™μŠ΅λ‹ˆλ‹€.

_.findWhere도 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이것도 μΆ”κ°€ν•΄μ£Όμ‹œλ©΄ μ•ˆλ κΉŒμš”...

κ·ΈλŒ€λ‘œ _.assign

_.flatMapDeep μ£Όμ„Έμš”? :)

LoDashExplicitArrayWrapper의 _.max

μΈν„°νŽ˜μ΄μŠ€ LoDashExplicitArrayWrapper{
/**
* @see _.max
*/
μ΅œλŒ€(
반볡자: ListIterator
): LoDashExplicitWrapper;

    /**
     * <strong i="17">@see</strong> _.max
     */
    max(iteratee: string): LoDashExplicitWrapper<number>;

    /**
     * <strong i="18">@see</strong> _.max
     */
    max(): LoDashExplicitWrapper<number>;

    /**
     * <strong i="19">@see</strong> _.max
     */
    max(iteratee: Dictionary<{}>): LoDashExplicitWrapper<number>;
}

μ™œ 이것이 λ‹«ν˜€ μžˆλŠ”μ§€ ν™•μ‹€ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€ ... νƒ€μ΄ν•‘μ—μ„œ λˆ„λ½ 된 λ§Žμ€ λ°©λ²•μ΄μžˆλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€ ( μ €μ—κ²ŒλŠ” _.uniqWith )

및 _.find
λ‘˜ λ‹€
Property 'find' does not exist on type 'LoDashExplicitObjectWrapper<{}>'.
그리고
Property 'find' does not exist on type 'LoDashExplicitArrayWrapper<{}[]>'

및 _.쌍
Property 'pairs' does not exist on type 'LoDashStatic'.

_.포함

_.λ‚˜λˆ„λ‹€

_.chain 이후에 무엇이든지 이 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€. μˆ˜μ •ν•˜λŠ” 데 도움을 μ£Όμ„Έμš” @chrootsu @rbcasperson

_.지도도...
이 λ¬Έμ œλŠ” λ‹€μ‹œ μ—΄μ–΄μ•Ό ν•©λ‹ˆλ‹€.

μœ„μ˜ λŒ“κΈ€μ„ ν™•μΈν–ˆλŠ”λ° μ—¬μ „νžˆ λˆ„λ½λœ 것 κ°™μŠ΅λ‹ˆλ‹€.

_.divide();
_.include();
_.pairs();

이 λ²„κ·ΈλŠ” λ§Žμ€ λ©”μ†Œλ“œ(μœ„μ— 언급됨)κ°€ μ—¬μ „νžˆ μ˜¬λ°”λ₯Έ 타이핑을 가지고 μžˆμ§€ μ•ŠκΈ° λ•Œλ¬Έμ— λ‹€μ‹œ μ—΄μ–΄μ•Ό ν•©λ‹ˆλ‹€.

λ˜ν•œ λ³€ν™˜ 도 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.
μ—¬κΈ°μ—μ„œ λ‹€λ₯Έ μ‚¬λžŒμ΄ λ³„λ„λ‘œ λ³΄κ³ ν–ˆμŠ΅λ‹ˆλ‹€. #14748
이것은 곧 고쳐질 것인가?
ν•΄κ²° 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

ν•΄κ²° 방법은 λ‹€μŒκ³Ό 같을 수 μžˆμŠ΅λ‹ˆλ‹€.

(lodash.chain(stuff).pickBy(lodash.isArray) as any).transform(transformFunction, []).value();

_.mapValues()λŠ” UnderscoreStatic에 μ‘΄μž¬ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 이 방법은 lodash 친절 μ—…λ°μ΄νŠΈμ—μ„œ λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

_mapValuesλŠ” 체인에 ν¬ν•¨λ˜μ§€ μ•Šκ³  독립 μ‹€ν–‰ν˜•μœΌλ‘œ μž‘λ™ν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

'LoDashImplicitArrayWrapper' μœ ν˜•μ— 'keys' 속성이 μ—†μŠ΅λ‹ˆλ‹€.'

속성 '길이'κ°€ 'LoDashImplicitArrayWrapper<...>' μœ ν˜•μ— μ—†μŠ΅λ‹ˆλ‹€.

μœ ν˜• 'LoDashImplicitObjectWrapper'에 'differenceWith' 속성이 μ—†μŠ΅λ‹ˆλ‹€.'.

체인 λμ—μ„œ https://lodash.com/docs/#prototype -valueλ₯Ό ν˜ΈμΆœν•΄μ•Ό ν•©λ‹ˆλ‹€.

_.번 μ£Όμ„Έμš”

_.νŒŒν‹°μ…˜ μ£Όμ„Έμš”

_.cond 제발

_.λ‹€μŒλ„ λΆ€νƒλ“œλ¦½λ‹ˆλ‹€

_.upperCase 및 _.deburr λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.

chain(blabla).mapValues()......
tslint 였λ₯˜μ— λŒ€ν•œ κ²°κ³Ό
Property 'mapValues' does not exist on type 'LoDashExplicitObjectWrapper<{}>'.

Opps... lodash에 λ©”μ†Œλ“œκ°€ μ—†μŠ΅λ‹ˆλ‹€.

이것은 거의 μž‘λ™ν•˜μ§€λ§Œ .pickBy도 이 문제의 λŒ€μƒμ΄ λ©λ‹ˆλ‹€!

(lodash.chain(stuff).pickBy(lodash.isArray) as any).transform(transformFunction, []).value();

_.uniq와 ν•¨κ»˜ μ£Όμ„Έμš”

우리 슀슀둜 ν•΄κ²°ν•  수 μžˆλŠ” 방법이 μ—†μ„κΉŒμš”?

이 μŠ€λ ˆλ“œλŠ” λͺ‡ λ…„ 전이고 μ—¬μ „νžˆ μž‘λ™ν•˜μ§€ μ•ŠλŠ” κΈ°λŠ₯이 μžˆμŠ΅λ‹ˆλ‹€!

@charlesr1971 _.uniqWith 에도 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€. ν•¨μˆ˜κ°€ μ—¬μ „νžˆ μž‘λ™ν•˜μ§€λ§Œ μΈν„°νŽ˜μ΄μŠ€κ°€ 아직 μ •μ˜λ˜μ§€ μ•Šμ€ 것 κ°™μŠ΅λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰