File tree Expand file tree Collapse file tree 2 files changed +23
-12
lines changed
Expand file tree Collapse file tree 2 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,16 @@ function getGenericsForNamespace(namespace) {
5555 return '' ;
5656}
5757
58+ function getAnyGenericsForNamespace ( namespace ) {
59+ if ( namespacesWithTwoGeneric . includes ( namespace ) ) {
60+ return '<any, any>' ;
61+ }
62+ if ( namespacesWithOneGeneric . includes ( namespace ) ) {
63+ return '<any>' ;
64+ }
65+ return '' ;
66+ }
67+
5868function getCommonGenericsForNamespace ( namespace ) {
5969 if ( namespacesWithTwoGeneric . includes ( namespace ) ) {
6070 return '<K, V>' ;
@@ -89,7 +99,8 @@ export const $prototype = p => ({
8999 ` ,
90100 types : dedent `
91101 declare module '${ buildModulePath ( p ) } ' {
92- type method${ getGenericsForNamespace ( p . namespace ) } = ${ p . prefix ?? '' } ${ p . namespace } ${ getCommonGenericsForNamespace ( p . namespace ) } ['${ p . name } '];
102+ type methodType${ getGenericsForNamespace ( p . namespace ) } = ${ p . prefix ?? '' } ${ p . namespace } ${ getCommonGenericsForNamespace ( p . namespace ) } ['${ p . name } '];
103+ const method: methodType${ getAnyGenericsForNamespace ( p . namespace ) } ;
93104 export = method;
94105 }
95106 ` ,
Original file line number Diff line number Diff line change @@ -4,17 +4,17 @@ import '@core-js/pure/full/array-buffer/detached';
44import detached from '@core-js/pure/full/array-buffer/detached' ;
55
66// $prototype
7- // import at from '@core-js/pure/full/array/prototype/at';
8- // const atResult1: number = at.call([1, 2, 3], -2);
9- // at.apply([1, 2, 3], [-2]);
10- // // @ts -expect-error
11- // at.call([1, 2, 3], null);
12- // // @ts -expect-error
13- // at.call(123);
14- // // @ts -expect-error
15- // at('string');
16- // // @ts -expect-error
17- // at(null);
7+ import at from '@core-js/pure/full/array/prototype/at' ;
8+ const atResult1 : number = at . call ( [ 1 , 2 , 3 ] , - 2 ) ;
9+ at . apply ( [ 1 , 2 , 3 ] , [ - 2 ] ) ;
10+ // @ts -expect-error
11+ at . call ( [ 1 , 2 , 3 ] , null ) ;
12+ // @ts -expect-error
13+ at . call ( 123 ) ;
14+ // @ts -expect-error
15+ at ( 'string' ) ;
16+ // @ts -expect-error
17+ at ( null ) ;
1818
1919// $prototypeIterator
2020import arrayVirtualIterator from '@core-js/pure/full/array/prototype/iterator' ;
You can’t perform that action at this time.
0 commit comments