File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,26 @@ expectType<{ foo: number; bar: string; baz: boolean }>(
437437 expectType < [ 2 , 2 , 2 ] > ( a2 ) ;
438438 }
439439 expectType < [ string , string , string ] > ( a2 . map ( ( ) => "foo" ) ) ;
440+
441+ // https://github.com/uhyo/better-typescript-lib/issues/35
442+ function template ( strings : TemplateStringsArray , ...keys : string [ ] ) : string {
443+ const mapped = strings . map ( ( v ) => v ) ;
444+ expectType < number > ( mapped . length ) ;
445+ }
446+ {
447+ class ArrX extends Array < number > {
448+ constructor ( nums : number [ ] ) {
449+ super ( ...nums ) ;
450+ }
451+
452+ sum ( ) : number {
453+ return this . reduce ( ( s , n ) => s + n , 0 ) ;
454+ }
455+ }
456+ const arrX = new ArrX ( [ 2 , 3 , 4 ] ) ;
457+ const mapped = arrX . map ( ( v ) => String ( v ) ) ;
458+ expectType < number > ( mapped . length ) ;
459+ }
440460}
441461
442462// ArrayConstructor
You can’t perform that action at this time.
0 commit comments