Skip to content

Conversation

@tiagovtristao
Copy link
Contributor

@tiagovtristao tiagovtristao commented Sep 20, 2020

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.

@ghost
Copy link

ghost commented Sep 20, 2020

CLA assistant check
All CLA requirements met.

Copy link
Member

@sandersn sandersn left a 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.

@karol-majewski
Copy link

Thank you @tiagovtristao!

@sandersn sandersn merged commit 1191e2e into microsoft:master Oct 5, 2020
@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.

Labels

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

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Class expressions: illegal assignments are allowed

6 participants