UNPKG

5.53 kBTypeScriptView Raw
1import _ = require("../index");
2declare module "../index" {
3 // chain
4 interface LoDashStatic {
5 /**
6 * Creates a lodash object that wraps value with explicit method chaining enabled.
7 *
8 * @param value The value to wrap.
9 * @return Returns the new lodash wrapper instance.
10 */
11 chain<TrapAny extends { __lodashAnyHack: any }>(value: TrapAny): CollectionChain<any> & FunctionChain<any> & ObjectChain<any> & PrimitiveChain<any> & StringChain;
12 /**
13 * @see _.chain
14 */
15 chain<T extends null | undefined>(value: T): PrimitiveChain<T>;
16 /**
17 * @see _.chain
18 */
19 chain(value: string): StringChain;
20 /**
21 * @see _.chain
22 */
23 chain(value: string | null | undefined): StringNullableChain;
24 /**
25 * @see _.chain
26 */
27 chain<T extends (...args: any[]) => any>(value: T): FunctionChain<T>;
28 /**
29 * @see _.chain
30 */
31 chain<T = any>(value: List<T> | null | undefined): CollectionChain<T>;
32 /**
33 * @see _.chain
34 */
35 chain<T extends object>(value: T | null | undefined): ObjectChain<T>;
36 /**
37 * @see _.chain
38 */
39 chain<T>(value: T): PrimitiveChain<T>;
40 }
41 interface Collection<T> {
42 /**
43 * @see _.chain
44 */
45 chain(): CollectionChain<T>;
46 }
47 interface String {
48 /**
49 * @see _.chain
50 */
51 chain(): StringChain;
52 }
53 interface Object<T> {
54 /**
55 * @see _.chain
56 */
57 chain(): ObjectChain<T>;
58 }
59 interface Primitive<T> {
60 /**
61 * @see _.chain
62 */
63 chain(): PrimitiveChain<T>;
64 }
65 interface Function<T extends (...args: any) => any> {
66 /**
67 * @see _.chain
68 */
69 chain(): FunctionChain<T>;
70 }
71 interface LoDashExplicitWrapper<TValue> {
72 /**
73 * @see _.chain
74 */
75 chain(): this;
76 }
77 // prototype.commit
78 interface LoDashImplicitWrapper<TValue> {
79 /**
80 * @see _.commit
81 */
82 commit(): this;
83 }
84 interface LoDashExplicitWrapper<TValue> {
85 /**
86 * @see _.commit
87 */
88 commit(): this;
89 }
90 // prototype.plant
91 interface LoDashImplicitWrapper<TValue> {
92 /**
93 * @see _.plant
94 */
95 plant(value: unknown): this;
96 }
97 interface LoDashExplicitWrapper<TValue> {
98 /**
99 * @see _.plant
100 */
101 plant(value: unknown): this;
102 }
103 // prototype.reverse
104 interface LoDashImplicitWrapper<TValue> {
105 /**
106 * @see _.reverse
107 */
108 reverse(): this;
109 }
110 interface LoDashExplicitWrapper<TValue> {
111 /**
112 * @see _.reverse
113 */
114 reverse(): this;
115 }
116 // prototype.toJSON
117 interface LoDashImplicitWrapper<TValue> {
118 /**
119 * @see _.toJSON
120 */
121 toJSON(): TValue;
122 }
123 interface LoDashExplicitWrapper<TValue> {
124 /**
125 * @see _.toJSON
126 */
127 toJSON(): TValue;
128 }
129 // prototype.toString
130 interface LoDashWrapper<TValue> {
131 /**
132 * @see _.toString
133 */
134 toString(): string;
135 }
136 // prototype.value
137 interface LoDashImplicitWrapper<TValue> {
138 /**
139 * @see _.value
140 */
141 value(): TValue;
142 }
143 interface LoDashExplicitWrapper<TValue> {
144 /**
145 * @see _.value
146 */
147 value(): TValue;
148 }
149 // prototype.valueOf
150 interface LoDashImplicitWrapper<TValue> {
151 /**
152 * @see _.valueOf
153 */
154 valueOf(): TValue;
155 }
156 interface LoDashExplicitWrapper<TValue> {
157 /**
158 * @see _.valueOf
159 */
160 valueOf(): TValue;
161 }
162 // tap
163 interface LoDashStatic {
164 /**
165 * This method invokes interceptor and returns value. The interceptor is invoked with one
166 * argument; (value). The purpose of this method is to "tap into" a method chain in order to perform operations
167 * on intermediate results within the chain.
168 *
169 * @param value The value to provide to interceptor.
170 * @param interceptor The function to invoke.
171 * @return Returns value.
172 */
173 tap<T>(value: T, interceptor: (value: T) => void): T;
174 }
175 interface LoDashImplicitWrapper<TValue> {
176 /**
177 * @see _.tap
178 */
179 tap(interceptor: (value: TValue) => void): this;
180 }
181 interface LoDashExplicitWrapper<TValue> {
182 /**
183 * @see _.tap
184 */
185 tap(interceptor: (value: TValue) => void): this;
186 }
187 // thru
188 interface LoDashStatic {
189 /**
190 * This method is like _.tap except that it returns the result of interceptor.
191 *
192 * @param value The value to provide to interceptor.
193 * @param interceptor The function to invoke.
194 * @return Returns the result of interceptor.
195 */
196 thru<T, TResult>(value: T, interceptor: (value: T) => TResult): TResult;
197 }
198 interface LoDashImplicitWrapper<TValue> {
199 /**
200 * @see _.thru
201 */
202 thru<TResult>(interceptor: (value: TValue) => TResult): ImpChain<TResult>;
203 }
204 interface LoDashExplicitWrapper<TValue> {
205 /**
206 * @see _.thru
207 */
208 thru<TResult>(interceptor: (value: TValue) => TResult): ExpChain<TResult>;
209 }
210}
211
\No newline at end of file