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

TS 3.2.1 compile errors in Component.ts #36

Open
2 tasks
enzy opened this issue Dec 5, 2018 · 3 comments
Open
2 tasks

TS 3.2.1 compile errors in Component.ts #36

enzy opened this issue Dec 5, 2018 · 3 comments
Labels

Comments

@enzy
Copy link
Contributor

enzy commented Dec 5, 2018

  • error 1
[tsl] ERROR in src\scripts\components\Component.ts(43,36)
      TS2684: The 'this' context of type '((event: FocusEvent) => void) | ((event: FocusEvent) => void) | ((event: Event) => void) | ((event: Event) => void) | ((event: UIEvent) => void) | ((event: AnimationEvent) => void) | ((event: AnimationEvent) => void) | ... 83 more ... | ((event: ClipboardEvent) => void)' is not assignable to method's 'this' of type '(this: this, event: FocusEvent) => void'.
  Type '(event: AnimationEvent) => void' is not assignable to type '(this: this, event: FocusEvent) => void'.
    Types of parameters 'event' and 'event' are incompatible.
      Type 'FocusEvent' is missing the following properties from type 'AnimationEvent': animationName, elapsedTime, pseudoElement
  • error 2
[tsl] ERROR in src\scripts\components\Component.ts(55,15)
      TS2684: The 'this' context of type '((event: DelegateEvent<"close">) => void) | ((event: DelegateEvent<"focusin">) => void) | ((event: DelegateEvent<"focusin">) => void) | ((event: DelegateEvent<"close">) => void) | ... 77 more ... | ((event: DelegateEvent<...>) => void)' is not assignable to method's 'this' of type '(this: this, event: DelegateEvent<"focusin">) => void'.
  Type '(event: DelegateEvent<"animationcancel">) => void' is not assignable to type '(this: this, event: DelegateEvent<"focusin">) => void'.
    Types of parameters 'event' and 'event' are incompatible.
      Type 'DelegateEvent<"focusin">' is not assignable to type 'DelegateEvent<"animationcancel">'.
        Type 'DelegateEvent<"focusin">' is missing the following properties from type 'AnimationEvent': animationName, elapsedTime, pseudoElement

@JirkaVebr ideas?

@enzy enzy added the bug label Dec 5, 2018
@enzy
Copy link
Contributor Author

enzy commented Dec 5, 2018

Adding "strictBindCallApply": false into tsconfig.json hides this, but I'm not pleased how a TS minor version update breaks that easily.
https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#strictbindcallapply

@JirkaVebr
Copy link
Contributor

→ The strict compiler flag that we're using is actually just a shortcut for many other ones and is intended to be potentially extended in an update whenever a new "strict" flag is introduced, like in this case with strictBindCallApply. This behavior is well-documented and users are openly discouraged to use strict if they insist on stability. Instead, they are instructed to enable each (or only some) of the other flags manually. Thus the decision essentially boils down to whether we want stability at the expense of some bugs not getting fixed in the long run or better code at the expense of slightly more laborious updates. I consciously chose the latter.

While I agree that this is a bit of a pain, I do stand by that decision. To mitigate the effects in practice, we should just use the @mangoweb/scripts-base package so that someone (well, probably me) can fix these issues just once and other don't have to worry about them. And that, in my opinion, is the true solution of this problem: rewrite this repo to use the package and fix it there. I'll get to it right away.

@enzy
Copy link
Contributor Author

enzy commented Dec 5, 2018

Thank you for the clarification!

I would oppose that stability is our main pain across projects using mango-cli (or any other bundler) as nobody want to update already "shipped" projects. Therefore any old "bugs" wouldn't get fixed anyway.

From the cli viewpoint I'm gonna need to lock the TS version between major releases to avoid these types of BC breaks.

scripts-base

Let's do it, this code is obsolete anyway.

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

No branches or pull requests

2 participants