GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix class expression from being assignable if types don't match by tiagovtristao · Pull Request #40660 · microsoft/TypeScript

Conversation

@tiagovtristao

@tiagovtristao Tiago Tristao (tiagovtristao) commented Sep 20, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR aims to fix #39469

A simpler code version highlighting the problem is seen below:

interface A {
  prop: string;
}

const A: {new(): A} = class {}

The const A declaration should be invalid since the initializer doesn't have the prop property.

Currently, the initializer is having members of the A symbol merged into it, which is invalid in this scenario. This is however the behaviour that it is expected for const declarations where the initializer is function-like, as seen in #26368.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zlianon and karol-majewski reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@tiagovtristao
Fix class expression from being assignable if types don't match
404f795
@ghost

Deleted user (ghost) commented Sep 20, 2020 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot TypeScript Bot (typescript-bot) assigned Ron Buckton (rbuckton) Sep 20, 2020
@typescript-bot TypeScript Bot (typescript-bot) added the For Milestone Bug PRs that fix a bug with a specific milestone label Sep 20, 2020
@tiagovtristao Tiago Tristao (tiagovtristao) mentioned this pull request Sep 20, 2020
Class expressions: illegal assignments are allowed #39469
Closed
@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) requested review from Ron Buckton (rbuckton) and Nathan Shively-Sanders (sandersn) September 21, 2020 18:56
nitish-awasthi
Nitish Awasthi (nitish-awasthi) approved these changes Sep 22, 2020
View reviewed changes
sandersn
Nathan Shively-Sanders (sandersn) requested changes Sep 30, 2020
View reviewed changes

@sandersn Nathan Shively-Sanders (sandersn) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I just moved getDeclarationOfExpando to getSymbolOfExpando in checker.ts. You'll need to make this change there.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/compiler/utilities.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Tiago Tristao (tiagovtristao) added 2 commits October 3, 2020 14:56
@tiagovtristao
Merge branch 'master' of https://github.com/microsoft/TypeScript into…
29f0841
… issue-39469
@tiagovtristao
Fix class expression from being assignable if types don't match
6b3ff5f
@karol-majewski

Karol Majewski (karol-majewski) commented Oct 5, 2020

Copy link
Copy Markdown

Thank you Tiago Tristao (@tiagovtristao)!

tiagovtristao reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sandersn
Nathan Shively-Sanders (sandersn) approved these changes Oct 5, 2020
View reviewed changes
@sandersn
Nathan Shively-Sanders (sandersn) merged commit 1191e2e into microsoft:master Oct 5, 2020
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@sandersn Nathan Shively-Sanders (sandersn) sandersn approved these changes
@rbuckton Ron Buckton (rbuckton) Awaiting requested review from rbuckton
+1 more reviewer
@nitish-awasthi Nitish Awasthi (nitish-awasthi) nitish-awasthi approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@rbuckton Ron Buckton (rbuckton)

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

PR Backlog
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Class expressions: illegal assignments are allowed

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@tiagovtristao @karol-majewski @sandersn @nitish-awasthi @rbuckton @typescript-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.