File tree Expand file tree Collapse file tree 2 files changed +21
-22
lines changed Expand file tree Collapse file tree 2 files changed +21
-22
lines changed Original file line number Diff line number Diff line change @@ -12,17 +12,16 @@ import { clampText } from '../../util/text.js';
1212import type { ProviderConfig } from './types.js' ;
1313import { createBaseConfig , getSearchUrl , SEARCH_TERM , TERM } from './utils.js' ;
1414
15+ type SearchItem = {
16+ mdn_url : string ;
17+ title : string ;
18+ slug : string ;
19+ summary : string ;
20+ } ;
1521type SearchResult = {
16- documents : Array < {
17- mdn_url : string ;
18- title : string ;
19- slug : string ;
20- summary : string ;
21- } > ;
22+ documents : SearchItem [ ] ;
2223} ;
2324
24- type SearchItem = SearchResult [ 'documents' ] [ number ] ;
25-
2625const baseConfig = createBaseConfig ( {
2726 color : 0x83_d0_f2 ,
2827 icon : 'https://avatars0.githubusercontent.com/u/7565578' ,
Original file line number Diff line number Diff line change @@ -13,32 +13,32 @@ import { clampText } from '../../util/text.js';
1313import type { ProviderConfig } from './types.js' ;
1414import { createBaseConfig , getSearchUrl , SEARCH_TERM , TERM } from './utils.js' ;
1515
16+ type SearchItem = {
17+ name : string ;
18+ version : string ;
19+ description : string ;
20+ license : string ;
21+ links : {
22+ npm : string ;
23+ homepage ?: string ;
24+ repository ?: string ;
25+ } ;
26+ } ;
27+
1628type SearchResult = {
1729 objects : Array < {
18- package : {
19- name : string ;
20- version : string ;
21- description : string ;
22- license : string ;
23- links : {
24- npm : string ;
25- homepage ?: string ;
26- repository ?: string ;
27- } ;
28- } ;
30+ package : SearchItem ;
2931 } > ;
3032} ;
3133
32- type Item = SearchResult [ 'objects' ] [ number ] [ 'package' ] ;
33-
3434const baseConfig = createBaseConfig ( {
3535 color : 0xfb_3e_44 ,
3636 icon : 'https://avatars0.githubusercontent.com/u/6078720' ,
3737 directUrl : `https://www.npmjs.com/package/${ TERM } ` ,
3838 commandDescription : 'Search NPM for JavaScript packages' ,
3939} ) ;
4040
41- export const npmProvider : ProviderConfig < Item > = {
41+ export const npmProvider : ProviderConfig < SearchItem > = {
4242 ...baseConfig ,
4343 getFilteredData : async ( query : string ) => {
4444 const response = await fetch (
You can’t perform that action at this time.
0 commit comments