Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving source type in toJS return value #543

Closed
jimkyndemeyer opened this issue Sep 8, 2016 · 1 comment
Closed

Preserving source type in toJS return value #543

jimkyndemeyer opened this issue Sep 8, 2016 · 1 comment
Milestone

Comments

@jimkyndemeyer
Copy link

The current toJS implementation has the following signature:

typescript
function toJS(source: any, detectCycles?: boolean, __alreadySeen?: [any, any][]): any;

I'd like to see it return the same type as it takes as source, so I don't have to cast the return value:

function toJS<T>(source: T, detectCycles?: boolean, __alreadySeen?: [any, any][]): T;

I tested with TypeScript 1.8, and the signature change seems compatible with existing code as TypeScript simply infers T.

@mweststrate
Copy link
Member

Closed, as this will be added to 3.0

@mweststrate mweststrate added this to the 3.0 milestone Nov 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants