Skip to content
This repository was archived by the owner on Jul 17, 2019. It is now read-only.

ericwooley/ts-recursive-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Repo to demonstrate typescript bug.

the function in pkg/src/index.ts allows you correctly infer types while in the pkg folder.

once built, the test-dep function imports the compiled version, and has issues with inference.

both pkg/src/index.ts and test-dep/index.ts use the function the same way, the way the typescript emitter keeps doesn't change the generic based on scope, all intermediate information is lost, because only the final U and the first T are used.

//...
                                deeper: <U extends Object>(child: U) => {
                                    result: T & U & U & U & U & U & U & U & U;
                                    deeper: <U extends Object>(child: U) => {
                                        result: T & U & U & U & U & U & U & U & U & U;
                                        deeper: <U extends Object>(child: U) => {
                                            result: T & U & U & U & U & U & U & U & U & U & U;
                                            deeper: <U extends Object>(child: U) => any;
                                        };
                                    };
                                };
//...                                

About

Demo of typescript emit problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published