Skip to content

why interface to Record<string, string> get an error, but use type is normal? #48985

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

Closed
WormGirl opened this issue May 6, 2022 · 2 comments
Closed
Labels
Question An issue which isn't directly actionable in code

Comments

@WormGirl
Copy link

WormGirl commented May 6, 2022

Bug Report

πŸ”Ž Search Terms

πŸ•— Version & Regression Information

  • This is a crash at offical playground.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

interface Menus {
  systemCode: string;
  systemName: string;
  systemId: string;
};
const b: Array<Menus> = [
  {
    systemCode: 'string',
    systemName: 'string',
    systemId: 'string'
  }
];
let a: Record<string, string>[] = [];
// this get error
a = b;
type Menus = {
  systemCode: string;
  systemName: string;
  systemId: string;
};
const b: Array<Menus> = [
  {
    systemCode: 'string',
    systemName: 'string',
    systemId: 'string'
  }
];
let a: Record<string, string>[] = [];
// this work fine, why ?
a = b;

πŸ™ Actual behavior

πŸ™‚ Expected behavior

@MartinJohns
Copy link
Contributor

You forgot to fill out the issue template. Duplicate of #42825.

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label May 6, 2022
@RyanCavanaugh
Copy link
Member

It looks like this is a question rather than a bug report. This issue tracker is for tracking bugs and active work on TypeScript itself, rather than a general forum for programmers using TypeScript to get help or ask questions.

You can ask questions on sites like Stack Overflow. We are not able to provide one-on-one support on the issue tracker. Please read the issue template carefully - it has important information on what kinds of reports can be acted on here, as well as links to useful TypeScript resources. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

3 participants