Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support as const in no-object-literal-type-assertion #166

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
aboyton opened this issue Jan 31, 2019 · 1 comment · Fixed by #390
Closed

Support as const in no-object-literal-type-assertion #166

aboyton opened this issue Jan 31, 2019 · 1 comment · Fixed by #390
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@aboyton
Copy link
Contributor

aboyton commented Jan 31, 2019

Sorry for not using the template, it didn't seem to apply in this case. This ticket is related to #66. Feel free to close if you think it is covered by other tickets.

TypeScript have merged in a new feature as const (slated for TypeScript 3.4, see microsoft/TypeScript#29510). This should get around many of the times where I need to say things like:

return {
  type: ChunkContents.LINK,
  content: linkMatch[2],
  ref: linkMatch[1],
} as {
  type: ChunkContents.LINK;
  content: string;
  ref: string;
};

It would be great to get the rule no-object-literal-type-assertion to support as const but disallow as someOtherType (at least as an option).

@aboyton aboyton added the triage Waiting for team members to take a look label Jan 31, 2019
@bradzacher bradzacher added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin package: typescript-estree Issues related to @typescript-eslint/typescript-estree enhancement: plugin rule option New rule option for an existing eslint-plugin rule and removed triage Waiting for team members to take a look labels Jan 31, 2019
@bradzacher
Copy link
Member

ohh i didn't know they were adding that! That's an awesome feature!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
2 participants