Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

0.8.0: type-annotation-spacing bug #79

Closed
pat841 opened this issue Oct 6, 2017 · 4 comments
Closed

0.8.0: type-annotation-spacing bug #79

pat841 opened this issue Oct 6, 2017 · 4 comments

Comments

@pat841
Copy link

pat841 commented Oct 6, 2017

In 0.7.0, this line would pass lint checking:

  resolver: (() => PromiseLike<T>) | PromiseLike<T>;

In 0.8.0, I get this error:

13:13 error Expected a space after the '(' typescript/type-annotation-spacing

where ( in the error represents the first parenthesis after the :

@j-f1
Copy link
Collaborator

j-f1 commented Oct 6, 2017

Thanks for reporting this!

Do these ones throw the error?

interface Foo<T> {
  resolver: (() => PromiseLike<T>);
  resolver: () => PromiseLike<T>;
  resolver: (PromiseLike<T>);
  resolver: () => PromiseLike<T> | PromiseLike<T>;
}

@pat841
Copy link
Author

pat841 commented Oct 6, 2017

@j-f1

Using 0.8.0:

interface Foo<T> {
  resolverOne: (PromiseLike<T>); // type-annotation-spacing error
  resolverTwo: (() => PromiseLike<T>); // type-annotation-spacing error
  resolverThree: () => PromiseLike<T>;
  resolverFour: () => PromiseLike<T> | PromiseLike<T>;
}

The issue with writing () => PromiseLike<T> | PromiseLike<T>; is because TypeScript assumes the union is for the arrow function result type and NOT the resolver type union.

@weirdpattern
Copy link
Collaborator

@j-f1 are you working on this?
I think I know what's going on and will be happy to submit a PR to get this fixed

@j-f1
Copy link
Collaborator

j-f1 commented Oct 6, 2017

@weirdpattern I’m kinda busy, so go ahead!

weirdpattern added a commit to weirdpattern/eslint-plugin-typescript that referenced this issue Oct 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants