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

Overload resolution #3

Open
AGBrown opened this issue Apr 29, 2015 · 2 comments
Open

Overload resolution #3

AGBrown opened this issue Apr 29, 2015 · 2 comments

Comments

@AGBrown
Copy link
Owner

AGBrown commented Apr 29, 2015

Related to #1

Need to work on overload resolution. Example:

A:

get<R extends ExistingDoc>(docId: string, options?: Options, callback?: async.Callback<R>): void;

vs.
B:

get<R extends ExistingDoc>(docId: string, options: Options, callback?: async.Callback<R>): void;
get<R extends ExistingDoc>(docId: string, callback?: async.Callback<R>): void;

Using A then the following code shows err in intellisense/type-checking as any. Using B err is correctly (and more helpfully) identified as Error | {}

db.get(info.id, (err) => {
    expect(err.error).to.exist;
    done();
});
@AGBrown
Copy link
Owner Author

AGBrown commented Apr 30, 2015

Largely done - still need to add some correctness tests to pouchdb-tests.ts for one or two api methods.

@fredgalvao
Copy link
Contributor

This should not be a rule, I'd guess this is a bug in intellisense on whichever IDE that is. Seeing this issue I now understand the reason for so many overloads 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants