Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const state: "expired" | "pending" = "pending";
function main() {
return {
type: `${state}Request` as `${typeof state}Request`
};
}
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unnecessary-type-assertion": ["error"],
},
};
tsconfig
Expected Result
The code should be fine as the type assertion changes the type from string
to "expiredRequest" | "pendingRequest"
Actual Result
There was an error 5th line saying:
This assertion is unnecessary since it does not change the type of the expression. 5:11 - 5:56
Additional Info
No response