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

BUG [TS2416]: Incorrect error reporting #42858

Closed
3 tasks done
dalisoft opened this issue Feb 18, 2021 · 2 comments
Closed
3 tasks done

BUG [TS2416]: Incorrect error reporting #42858

dalisoft opened this issue Feb 18, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@dalisoft
Copy link

Bug Report

🔎 Search Terms

  • ts2416 class can't extend interface
  • typescript interface string type cant assign
  • Full message copy of error

🕗 Version & Regression Information

Playground link with relevant code

💻 Code

export interface IStoreApp {
  windowWidth: number;
  windowHeight: number;
  pageActive: boolean;
  isLoading: boolean;
  language: 'en' | 'ru' | 'tt'; // <-- This line
}
class App implements IStoreApp {
  // Environment observables
  @observable windowWidth = 0;

  @observable windowHeight = 0;

  @observable pageActive = true;

  // PWA environments
  @observable isLoading = true;

  // User observables
  @observable language = 'en'; // <-- This line
}
export default new App();

🙁 Actual behavior

Property 'language' in type 'App' is not assignable to the same property in base type 'IStoreApp'.
  Type 'string' is not assignable to type '"en" | "ru" | "tt"'.

🙂 Expected behavior

Working type validating with one of three available language

@MartinJohns
Copy link
Contributor

Duplicate of #10570.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Feb 18, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants