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

Outdated WHATWG DOM Event interface and init #17974

Closed
KamiQuasi opened this issue Aug 23, 2017 · 3 comments
Closed

Outdated WHATWG DOM Event interface and init #17974

KamiQuasi opened this issue Aug 23, 2017 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@KamiQuasi
Copy link

TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
document.dispatchEvent(new CustomEvent('test-event', { detail: { foo: 'bar' }, bubbles: true, composed: true }));

Expected behavior:
Utilizing the 'composed' property should work. As per the WHATWG Living Standard the 'scoped' and 'deepPath' properties of an Event have been replaced with 'composed' and 'composedPath' respectively (see https://dom.spec.whatwg.org/)

Actual behavior:
Argument of type '{ detail: { term: string; }; bubbles: true; composed: boolean; }' is not assignable to parameter of type 'CustomEventInit'.
Object literal may only specify known properties, and 'composed' does not exist in type 'CustomEventInit'.

@kitsonk
Copy link
Contributor

kitsonk commented Aug 23, 2017

composed is part of the ShadowDom v1 specification and it seems like it is only implemented in Chrome and Firefox at the moment.

That being said, changes to these interfaces are contributed via the TSJS-lib-generator and contribution guidelines can be found here

Also, interfaces are open ended, so you could easily add this to your local project, knowing that you were going to run in an environment where this was supported:

declare global {
  interface Event {
    readonly composed: boolean;
  }
}

@KamiQuasi
Copy link
Author

@kitsonk hoping I didn't misread the contribution guidelines on the TSJS-lib-generator repo, but it seemed to say to make changes there I should submit an issue here to reference. I've submitted a PR on that repo that should adjust this (microsoft/TypeScript-DOM-lib-generator#284). The main reason I wanted to get this change in was for compatibility with the webcomponents v1 polyfill, which also implements the composed and composedPath properties.

@kitsonk
Copy link
Contributor

kitsonk commented Aug 23, 2017

Apologies, missed the linked issue... 😊

@mhegazy mhegazy added the Needs Investigation This issue needs a team member to investigate its status. label Aug 29, 2017
@KamiQuasi KamiQuasi changed the title Outdated WHATWG DOM Event interface and init Update to WHATWG DOM Living Standard for Events Apr 6, 2018
@KamiQuasi KamiQuasi changed the title Update to WHATWG DOM Living Standard for Events Outdated WHATWG DOM Event interface and init Apr 6, 2018
@mhegazy mhegazy added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet and removed Needs Investigation This issue needs a team member to investigate its status. labels Apr 6, 2018
@mhegazy mhegazy self-assigned this Apr 6, 2018
@mhegazy mhegazy added this to the TypeScript 2.9 milestone Apr 6, 2018
@mhegazy mhegazy modified the milestones: TypeScript 2.9, TypeScript 3.0 May 8, 2018
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet labels Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

3 participants