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

Getting typescript compile error on beta.0 with noPropertyAccessFromIndexSignature #3494

Closed
evertbouw opened this issue May 31, 2023 · 0 comments
Milestone

Comments

@evertbouw
Copy link
Contributor

evertbouw commented May 31, 2023

Upgrading from alpha.6 to beta.0 and I'm now getting a compile error while using the noPropertyAccessFromIndexSignature flag.

node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@reduxjs/toolkit/dist/uncheckedindexed.ts:5:46 - error TS4111: Property 'a' comes from an index signature, so it must be accessed with ['a'].

5 const testAccess = ({} as Record<string, 0>).a
                                               ~


Found 1 error in node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@reduxjs/toolkit/dist/uncheckedindexed.ts:5

if I change that line to

const testAccess = ({} as Record<string, 0>)['a']

it compiles just fine.

tsconfig

{
	"extends": "@tsconfig/vite-react/tsconfig.json",
	"compilerOptions": {
		"moduleResolution": "node",
		"allowUnusedLabels": false,
		"allowUnreachableCode": false,
		"exactOptionalPropertyTypes": true,
		"noFallthroughCasesInSwitch": true,
		"noImplicitAny": true,
		"noImplicitOverride": true,
		"noImplicitReturns": true,
		"noPropertyAccessFromIndexSignature": true,
		"noUncheckedIndexedAccess": true,
		"noUnusedLocals": true,
		"noUnusedParameters": true,
		"baseUrl": ".",
		"verbatimModuleSyntax": true,
		"types": ["@testing-library/jest-dom", "vite-plugin-pwa/react", "vite/types/importMeta"]
	},
	"include": ["src", "tests"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants