File tree Expand file tree Collapse file tree 6 files changed +32
-3
lines changed Expand file tree Collapse file tree 6 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 8
8
### Bug Fixes
9
9
10
10
- Fixed validation for ` --requiredToBeDocumented ` option, #1872 .
11
+ - Fixed missing ` this ` parameters in documentation for some functions, #1875 .
11
12
12
13
## v0.22.12 (2022-02-20)
13
14
Original file line number Diff line number Diff line change @@ -58,10 +58,15 @@ export function createSignature(
58
58
signature . typeParameters
59
59
) ;
60
60
61
+ const parameterSymbols : ReadonlyArray < ts . Symbol & { type ?: ts . Type } > =
62
+ signature . thisParameter
63
+ ? [ signature . thisParameter , ...signature . parameters ]
64
+ : signature . parameters ;
65
+
61
66
sigRef . parameters = convertParameters (
62
67
context ,
63
68
sigRef ,
64
- signature . parameters as readonly ( ts . Symbol & { type : ts . Type } ) [ ] ,
69
+ parameterSymbols ,
65
70
declaration ?. parameters
66
71
) ;
67
72
@@ -105,7 +110,7 @@ export function createSignature(
105
110
function convertParameters (
106
111
context : Context ,
107
112
sigRef : SignatureReflection ,
108
- parameters : readonly ( ts . Symbol & { type : ts . Type } ) [ ] ,
113
+ parameters : ReadonlyArray < ts . Symbol & { type ? : ts . Type } > ,
109
114
parameterNodes : readonly ts . ParameterDeclaration [ ] | undefined
110
115
) {
111
116
return parameters . map ( ( param , i ) => {
@@ -129,7 +134,7 @@ function convertParameters(
129
134
declaration
130
135
) ;
131
136
132
- let type : ts . Type | ts . TypeNode ;
137
+ let type : ts . Type | ts . TypeNode | undefined ;
133
138
if ( declaration ) {
134
139
type = context . checker . getTypeOfSymbolAtLocation (
135
140
param ,
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ declare module "typescript" {
22
22
) : ts . TypePredicate | undefined ;
23
23
}
24
24
25
+ export interface Signature {
26
+ thisParameter ?: ts . Symbol ;
27
+ }
28
+
25
29
// https://github.com/microsoft/TypeScript/blob/e213b2af3430bdc9cf5fbc76a8634d832e7aaaaa/src/compiler/types.ts#L5298-L5299
26
30
export interface UnionType {
27
31
/* @internal */
Original file line number Diff line number Diff line change
1
+ export declare function test ( this : typeof globalThis , param : string ) : string ;
2
+
3
+ export declare function test2 ( this , param : string ) : string ;
Original file line number Diff line number Diff line change 6
6
"outDir" : " dist" ,
7
7
"target" : " ESNext" ,
8
8
9
+ "noImplicitAny" : false ,
10
+
9
11
// See #1524. We might force this to false eventually.
10
12
"skipLibCheck" : true
11
13
},
Original file line number Diff line number Diff line change @@ -292,6 +292,20 @@ export const issueTests: {
292
292
ok ( project . children ! [ 1 ] . kind !== ReflectionKind . Reference ) ;
293
293
} ,
294
294
295
+ gh1875 ( project ) {
296
+ const test = query ( project , "test" ) ;
297
+ equal (
298
+ test . signatures ?. [ 0 ] . parameters ?. map ( ( p ) => p . type ?. toString ( ) ) ,
299
+ [ "typeof globalThis" , "string" ]
300
+ ) ;
301
+
302
+ const test2 = query ( project , "test2" ) ;
303
+ equal (
304
+ test2 . signatures ?. [ 0 ] . parameters ?. map ( ( p ) => p . type ?. toString ( ) ) ,
305
+ [ "any" , "string" ]
306
+ ) ;
307
+ } ,
308
+
295
309
gh1876 ( project ) {
296
310
const foo = query ( project , "foo" ) ;
297
311
const fooSig = foo . signatures ?. [ 0 ] . parameters ?. [ 0 ] ;
You can’t perform that action at this time.
0 commit comments