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

Ensure required instance variables are set #17184

Closed
matthewmueller opened this issue Jul 14, 2017 · 2 comments
Closed

Ensure required instance variables are set #17184

matthewmueller opened this issue Jul 14, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@matthewmueller
Copy link

TypeScript Version: 2.4.0

Code

class Greeter {
  greeting: {
    en: 'world!'
  } 
  constructor(message: string) {
 
  }
  greet() {
      return "Hello, " + this.greeting.en;
  }
}

let greeter = new Greeter("world");
greeter.greet()

Expected behavior:

It would complain that this.greeting.en has not been set in the constructor.

Actual behavior:

Runtime error 🙀

@RyanCavanaugh
Copy link
Member

Duplicate of #8476

@RyanCavanaugh RyanCavanaugh marked this as a duplicate of #8476 Jul 14, 2017
@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 14, 2017
@matthewmueller
Copy link
Author

@RyanCavanaugh ah there it is. sorry about that!

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants