@@ -16,6 +16,12 @@ function foo(baz: string): string;
1616function foo(qux: boolean): string;
1717function foo(whatever: any): any { }
1818
19+ // TODO: Decide on whether to allow or deny this example (TSEslint passes, though of dubious merit)
20+ // /** baba is you */
21+ // export function foo(bar: string): void
22+ // export function foo(bar: number): void
23+ // export function foo(bar: any): void { }
24+
1925// jsdoc on implementation
2026
2127function bar(a: number): string;
@@ -61,7 +67,7 @@ declare function f10(this: number): void;
6167` ` `
6268invalidJsdoc.ts:2:1 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6369
64- i Overload signatures are hard to read and maintain.
70+ i Multiple similar overload signatures are hard to read and maintain.
6571
6672 1 │ // no jsdoc is still fair game
6773 > 2 │ function f(bar: number): string;
@@ -85,7 +91,7 @@ invalidJsdoc.ts:2:1 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━
8591` ` `
8692invalidJsdoc.ts:9:1 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8793
88- i Overload signatures are hard to read and maintain.
94+ i Multiple similar overload signatures are hard to read and maintain.
8995
9096 7 │ /** jsdoc 1 */
9197 8 │ function foo(bar: number): string;
@@ -108,126 +114,138 @@ invalidJsdoc.ts:9:1 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━
108114` ` `
109115
110116` ` `
111- invalidJsdoc.ts:15 :1 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
117+ invalidJsdoc.ts:21 :1 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
112118
113- i Overload signatures are hard to read and maintain.
119+ i Multiple similar overload signatures are hard to read and maintain.
114120
115- 13 │ // jsdoc on implementation
116- 14 │
117- > 15 │ function bar(a: number): string;
121+ 19 │ // jsdoc on implementation
122+ 20 │
123+ > 21 │ function bar(a: number): string;
118124 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119- 16 │ function bar(a: string): string;
120- 17 │ function bar(a: boolean): string;
125+ 22 │ function bar(a: string): string;
126+ 23 │ function bar(a: boolean): string;
121127
122128 i Unsafe fix: Combine overloads using a type union.
123129
124130 10 10 │ function foo(qux: boolean): string;
125131 11 11 │ function foo(whatever: any): any { }
126132 12 │ -
127- 13 │ - //·jsdoc·on·implementation
128- 14 │ -
129- 15 │ - function·bar(a:·number):·string;
130- 16 │ - function·bar(a:·string):·string;
133+ 13 │ - //·TODO:·Decide·on·whether·to·allow·or·deny·this·example·(TSEslint·passes,·though·of·dubious·merit)
134+ 14 │ - //·/**·baba·is·you·*/
135+ 15 │ - //·export·function·foo(bar:·string):·void→
136+ 16 │ - //·export·function·foo(bar:·number):·void
137+ 17 │ - //·export·function·foo(bar:·any):·void·{ } ·
138+ 18 │ -
139+ 19 │ - //·jsdoc·on·implementation
140+ 20 │ -
141+ 21 │ - function·bar(a:·number):·string;
142+ 22 │ - function·bar(a:·string):·string;
131143 12 │ +
132- 13 │ + //·jsdoc·on·implementation
133- 14 │ +
134- 15 │ + function·bar(a:·string·|·number):·string;
135- 17 16 │ function bar(a: boolean): string;
136- 18 17 │ /** jsdoc 1 */
144+ 13 │ + //·TODO:·Decide·on·whether·to·allow·or·deny·this·example·(TSEslint·passes,·though·of·dubious·merit)
145+ 14 │ + //·/**·baba·is·you·*/
146+ 15 │ + //·export·function·foo(bar:·string):·void→
147+ 16 │ + //·export·function·foo(bar:·number):·void
148+ 17 │ + //·export·function·foo(bar:·any):·void·{ } ·
149+ 18 │ +
150+ 19 │ + //·jsdoc·on·implementation
151+ 20 │ +
152+ 21 │ + function·bar(a:·string·|·number):·string;
153+ 23 22 │ function bar(a: boolean): string;
154+ 24 23 │ /** jsdoc 1 */
137155
138156
139157` ` `
140158
141159` ` `
142- invalidJsdoc.ts:26 :2 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
160+ invalidJsdoc.ts:32 :2 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
143161
144- i Overload signatures are hard to read and maintain.
162+ i Multiple similar overload signatures are hard to read and maintain.
145163
146- 24 │ (a: string, b: number, c: number): string;
147- 25 │ /*************************** HIJKLMNOPQRS */
148- > 26 │ (a: number, b: number, c: string): string;
164+ 30 │ (a: string, b: number, c: number): string;
165+ 31 │ /*************************** HIJKLMNOPQRS */
166+ > 32 │ (a: number, b: number, c: string): string;
149167 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
150- 27 │ /* t u v w x y z */
151- 28 │ (a: number, b: string, c: string): string;
168+ 33 │ /* t u v w x y z */
169+ 34 │ (a: number, b: string, c: string): string;
152170
153171 i Unsafe fix: Combine overloads using a type union.
154172
155- 23 23 │ // a b c d e f g...
156- 24 24 │ (a: string, b: number, c: number): string;
157- 25 │ - → /***************************·HIJKLMNOPQRS·*/
158- 26 │ - → (a:·number,·b:·number,·c:·string):·string;
159- 27 │ - → /*·t·u·v·w·x·y·z·*/
160- 28 │ - → (a:·number,·b:·string,·c:·string):·string;
161- 25 │ + → /***************************·HIJKLMNOPQRS·*/
162- 26 │ + → → /*·t·u·v·w·x·y·z·*/
163- 27 │ + → (a:·number,·b:·string·|·number,·c:·string):·string;
164- 29 28 │ }
165- 30 29 │
173+ 29 29 │ // a b c d e f g...
174+ 30 30 │ (a: string, b: number, c: number): string;
175+ 31 │ - → /***************************·HIJKLMNOPQRS·*/
176+ 32 │ - → (a:·number,·b:·number,·c:·string):·string;
177+ 33 │ - → /*·t·u·v·w·x·y·z·*/
178+ 34 │ - → (a:·number,·b:·string,·c:·string):·string;
179+ 31 │ + → /***************************·HIJKLMNOPQRS·*/
180+ 32 │ + → → /*·t·u·v·w·x·y·z·*/
181+ 33 │ + → (a:·number,·b:·string·|·number,·c:·string):·string;
182+ 35 34 │ }
183+ 36 35 │
166184
167185
168186` ` `
169187
170188` ` `
171- invalidJsdoc.ts:34 :2 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
189+ invalidJsdoc.ts:40 :2 lint/style/useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
172190
173- i Overload signatures are hard to read and maintain.
191+ i Multiple similar overload signatures are hard to read and maintain.
174192
175- 32 │ class banana {
176- 33 │ /** bake a cake */
177- > 34 │ public bake (cakeType : string ): void ;
193+ 38 │ class banana {
194+ 39 │ /** bake a cake */
195+ > 40 │ public bake (cakeType : string ): void ;
178196 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
179- 35 │ /** bake a cake */
180- 36 │ public bake (flourAmt : number ): void ;
197+ 41 │ /** bake a cake */
198+ 42 │ public bake (flourAmt : number ): void ;
181199
182200 i Unsafe fix : Combine overloads using a type union .
183201
184- 31 31 │ // same jsdocs
185- 32 32 │ class banana {
186- 33 │ - → /** ·bake·a·cake·*/
187- 34 │ - → public ·bake(cakeType : ·string ): ·void ;
188- 35 33 │ /** bake a cake */
189- 36 │ - → public ·bake(flourAmt : ·number ): ·void ;
190- 34 │ + → → /** ·bake·a·cake·*/
191- 35 │ + → public ·bake(flourAmt : ·number ·| ·string ): ·void ;
192- 37 36 │ /** bake a cake */
193- 38 37 │ public bake(ingredients : object ): void ;
202+ 37 37 │ // same jsdocs
203+ 38 38 │ class banana {
204+ 39 │ - → /** ·bake·a·cake·*/
205+ 40 │ - → public ·bake(cakeType : ·string ): ·void ;
206+ 41 39 │ /** bake a cake */
207+ 42 │ - → public ·bake(flourAmt : ·number ): ·void ;
208+ 40 │ + → → /** ·bake·a·cake·*/
209+ 41 │ + → public ·bake(flourAmt : ·number ·| ·string ): ·void ;
210+ 43 42 │ /** bake a cake */
211+ 44 43 │ public bake(ingredients : object ): void ;
194212
195213
196214` ` `
197215
198216` ` `
199- invalidJsdoc .ts : 46 :1 lint /style /useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
217+ invalidJsdoc .ts : 52 :1 lint /style /useUnifiedTypeSignatures FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
200218
201- i Overload signatures are hard to read and maintain .
219+ i Multiple similar overload signatures are hard to read and maintain .
202220
203- 44 │ /** jsdoc 2 */
204- 45 │ /** jsdoc 3 */
205- > 46 │ declare function f10(this : string ): void ;
221+ 50 │ /** jsdoc 2 */
222+ 51 │ /** jsdoc 3 */
223+ > 52 │ declare function f10(this : string ): void ;
206224 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207- 47 │ /** jsdoc 1 */
208- 48 │ /** jsdoc 2 */
225+ 53 │ /** jsdoc 1 */
226+ 54 │ /** jsdoc 2 */
209227
210228 i Unsafe fix: Combine overloads using a type union .
211229
212- 39 39 │ public bake(whatever : any ): void {};
213- 40 40 │ }
214- 41 │ -
215- 42 │ - // ·several·identical·jsdocs·(all·get·checked)
216- 43 │ - /** ·jsdoc·1·*/
217- 44 │ - /** ·jsdoc·2·*/
218- 45 │ - /** ·jsdoc·3·*/
219- 46 │ - declare ·function ·f10(this : ·string ): ·void ;
220- 41 │ +
221- 42 │ + // ·several·identical·jsdocs·(all·get·checked)
222- 43 │ + /** ·jsdoc·1·*/
223- 44 │ + /** ·jsdoc·2·*/
224- 45 │ + /** ·jsdoc·3·*/
225- 47 46 │ /** jsdoc 1 */
226- 48 47 │ /** jsdoc 2 */
227- 49 48 │ /** jsdoc 3 */
228- 50 │ - declare ·function ·f10(this : ·number ): ·void ;
229- 49 │ + declare ·function ·f10(this : ·number ·| ·string ): ·void ;
230- 51 50 │
230+ 45 45 │ public bake(whatever : any ): void {};
231+ 46 46 │ }
232+ 47 │ -
233+ 48 │ - // ·several·identical·jsdocs·(all·get·checked)
234+ 49 │ - /** ·jsdoc·1·*/
235+ 50 │ - /** ·jsdoc·2·*/
236+ 51 │ - /** ·jsdoc·3·*/
237+ 52 │ - declare ·function ·f10(this : ·string ): ·void ;
238+ 47 │ +
239+ 48 │ + // ·several·identical·jsdocs·(all·get·checked)
240+ 49 │ + /** ·jsdoc·1·*/
241+ 50 │ + /** ·jsdoc·2·*/
242+ 51 │ + /** ·jsdoc·3·*/
243+ 53 52 │ /** jsdoc 1 */
244+ 54 53 │ /** jsdoc 2 */
245+ 55 54 │ /** jsdoc 3 */
246+ 56 │ - declare ·function ·f10(this : ·number ): ·void ;
247+ 55 │ + declare ·function ·f10(this : ·number ·| ·string ): ·void ;
248+ 57 56 │
231249
232250
233251` ` `
0 commit comments