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

Add beautifiers property to OptionValues interface #105

Open
Glavin001 opened this issue Jun 5, 2018 · 2 comments
Open

Add beautifiers property to OptionValues interface #105

Glavin001 opened this issue Jun 5, 2018 · 2 comments
Assignees

Comments

@Glavin001
Copy link
Member

Describe the bug

image

To Reproduce
Steps to reproduce the behavior:

const options: OptionValues = {
  beautifiers: []
}

Expected behavior

No TypeScript errors are shown, beautifiers property is allowed.

Error/Stack Traces

[ts]
Argument of type '{ beautifiers: string[]; }' is not assignable to parameter of type 'OptionValues'.
  Object literal may only specify known properties, and 'beautifiers' does not exist in type 'OptionValues'.

System (please complete the following information):

  • OS: macOS
  • Version: El Capitan, 10.11.6

Additional context

🔥

@Glavin001
Copy link
Member Author

See Excluding certain properties from the index signature in https://basarat.gitbooks.io/typescript/docs/types/index-signatures.html

Related to microsoft/TypeScript#24300 and microsoft/TypeScript#17867

Unfortunately, this is not going to be possible with current version of TypeScript 😢 .

@Glavin001
Copy link
Member Author

After making a bunch of changes, I try it all out:

const test: OptionValues = {
  beautifiers: ["test"],
};

... and it throws an error:

Type '{ beautifiers: string[]; }' is not assignable to type 'OptionValues'.
  Type '{ beautifiers: string[]; }' is not assignable to type '{ [beautifierName: string]: BeautifierSpecificOptionValues & DependenciesForBeautifierRegistry; }'.
    Property 'beautifiers' is incompatible with index signature.
      Type 'string[]' is not assignable to type 'BeautifierSpecificOptionValues & DependenciesForBeautifierRegistry'.
        Type 'string[]' is not assignable to type 'DependenciesForBeautifierRegistry'.
          Index signature is missing in type 'string[]'.ts(2322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant