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

Fluent style incompatible with typescript #2503

Open
aicioara opened this issue Jul 24, 2015 · 8 comments
Open

Fluent style incompatible with typescript #2503

aicioara opened this issue Jul 24, 2015 · 8 comments

Comments

@aicioara
Copy link
Contributor

     var line = new Plottable.Plots.Line()
        .x(function(d) { return d.x; }, xScale)
        .y(function(d) { return d.y; }, yScale)
        .addDataset(new Plottable.Dataset(data))
        .autorangeMode("y")
error TS2339: Property 'autorangeMode' does not exist on type 'Plot'.

Issue: .addDataset returns this, but it is invoked on the Plottable.Plot, hence it returns a Plottable.Plot, instead of a Plottable.Plots.Line

There is a duplicate of this somewhere, if you find it, please close that one as duplicate, since it did not have an easy example / was outdated as far as I remember

@bluong
Copy link
Contributor

bluong commented Jul 24, 2015

Related microsoft/TypeScript#275

@aicioara
Copy link
Contributor Author

And #2119 from our end

@aicioara
Copy link
Contributor Author

Will close the older one for the sake of bumping and copying all information over here

@aicioara
Copy link
Contributor Author

Related typescript

Currently blocking on the following TypeScript issues

@rcchen said

Still valid; the easiest repro for this is chaining a method for a parent class on a subclass.
Example: new Plottable.Plots.Rectangle().x().x2()..
If .x() were not explicitly defined on Plots.Rectangle, .x2() would not work.
This is an open issue on Typescript as has been referenced above.

@jtlan
Copy link
Contributor

jtlan commented Nov 11, 2015

New ticket at microsoft/TypeScript#3694

@ronanquillevere
Copy link

+1

@hellochar
Copy link
Contributor

Typescript 2.0 has fixed this such that fluent style now preserves the polymorphic type in most cases; @ronanquillevere is there a specific instance where you're hitting this still in ts 2.0?

@ronanquillevere
Copy link

On 2.0.7 was not working with inheritance. Still returning the parent abstract type.

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

5 participants