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

feat(emitter): support differing accessor types #996

Merged
merged 1 commit into from
Apr 13, 2021

Conversation

saschanaz
Copy link
Contributor

Thanks to microsoft/TypeScript#42425

This turns out to be less interesting than I expected because of the setter type limitation where the getter type must be assignable to the setter type. Thus the following can't be supported:

[Exposed=Window]
interface CSSStyleRule : CSSRule {
  attribute CSSOMString selectorText;
  [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};
interface CSSStyleRule extends CSSRule {
    selectorText: string;
    get style(): CSSStyleDeclaration;
    set style(cssText: string); // error!
}
document.body.style = "display: none" // thus still an error 🤔

Probably worth to file an issue, or does TS team think this is not a very interesting case?

@saschanaz saschanaz requested a review from sandersn as a code owner March 28, 2021 00:37
Copy link
Contributor

@orta orta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, this is definitely the case I hit the most often with the DOM and it shows of 4.3's feature well

@sandersn
Copy link
Member

I think you should file an issue, because during the design of this feature, we decided on a conservative loosening of the rules. It would be good to have an issue to gather evidence for further loosening.

@orta I'm going to merge this, but it's a little late for putting DOM changes into 4.3. Do you agree?

@sandersn sandersn merged commit a75338e into microsoft:master Apr 13, 2021
@saschanaz saschanaz deleted the microsoft-differingaccessor branch April 13, 2021 21:39
@orta
Copy link
Contributor

orta commented Apr 14, 2021

Grudgingly agree

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

Successfully merging this pull request may close these issues.

3 participants