File tree 5 files changed +12
-5
lines changed
5 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,13 @@ export function formatMethodSignature(m: DocsInterfaceMethod) {
83
83
return `${ m . name } (${ m . parameters . length > 0 ? '...' : '' } )` ;
84
84
}
85
85
86
+ export function formatMethodSignatureForSlug ( m : DocsInterfaceMethod ) {
87
+ if ( m . name === 'addListener' && m . parameters . length > 0 ) {
88
+ return `addListener(${ m . parameters [ 0 ] . type . replace ( / \" / g, `'` ) } )` ;
89
+ }
90
+ return `${ m . name } (${ m . parameters . length > 0 ? '...' : '' } )` ;
91
+ }
92
+
86
93
function linkToken ( data : DocsData , token : string ) {
87
94
const t = token . replace ( / ` / g, '' ) ;
88
95
const i = data . interfaces . find ( i => {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import type {
15
15
} from './types' ;
16
16
import { getTsProgram } from './transpile' ;
17
17
import GithubSlugger from 'github-slugger' ;
18
- import { formatMethodSignature } from './formatting' ;
18
+ import { formatMethodSignatureForSlug } from './formatting' ;
19
19
20
20
/**
21
21
* Given either a tsconfig file path, or exact input files, will
@@ -325,7 +325,7 @@ function getInterfaceMethod(
325
325
slug : '' ,
326
326
} ;
327
327
328
- m . slug = slugify ( formatMethodSignature ( m ) ) ;
328
+ m . slug = slugify ( formatMethodSignatureForSlug ( m ) ) ;
329
329
330
330
return m ;
331
331
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ Below is an index of all the methods available.
11
11
* [ ` impact(...) ` ] ( #impact )
12
12
* [ ` notification(...) ` ] ( #notification )
13
13
* [ ` vibrate(...) ` ] ( #vibrate )
14
- * [ ` addListener('vibrate', ...) ` ] ( #addlistenervibrate- )
14
+ * [ ` addListener('vibrate', ...) ` ] ( #addlistenervibrate )
15
15
* [ ` removeAllListeners() ` ] ( #removealllisteners )
16
16
* [ Interfaces] ( #interfaces )
17
17
* [ Type Aliases] ( #type-aliases )
Original file line number Diff line number Diff line change 110
110
"complexTypes" : [
111
111
" VibrateListener"
112
112
],
113
- "slug" : " addlistenervibrate- "
113
+ "slug" : " addlistenervibrate"
114
114
},
115
115
{
116
116
"name" : " removeAllListeners" ,
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ describe('parse', () => {
90
90
91
91
const m3 = api . methods [ 3 ] ;
92
92
expect ( m3 . name ) . toBe ( `addListener` ) ;
93
- expect ( m3 . slug ) . toBe ( `addlistenervibrate- ` ) ;
93
+ expect ( m3 . slug ) . toBe ( `addlistenervibrate` ) ;
94
94
expect ( m3 . docs ) . toBe ( `Add a listener. Callback has VibrateOptions.` ) ;
95
95
expect ( m3 . signature ) . toBe (
96
96
`(eventName: 'vibrate', listenerFunc: VibrateListener) => Promise<void>` ,
You can’t perform that action at this time.
0 commit comments