tsc TS4111: Property comes from an index signature, must use bracket access in CI
TS4111 is raised under noPropertyAccessFromIndexSignature: a property reached only through an index signature must use bracket notation, not dot access. CI commonly hits this on process.env members.
What this error means
tsc fails with "error TS4111: Property 'NODE_ENV' comes from an index signature, so it must be accessed with ['NODE_ENV']." for a dotted access on an index-signature type.
src/config.ts:1:30 - error TS4111: Property 'NODE_ENV' comes from an index signature, so it must
be accessed with ['NODE_ENV'].
1 const isProd = process.env.NODE_ENV === 'production';
~~~~~~~~Common causes
Dot access on an index-signature property
process.env is typed with a string index signature. With noPropertyAccessFromIndexSignature, dotted access to its members is an error.
CI enables the option where local did not
The stricter option is on in the CI tsconfig, so dotted index access that compiled locally now fails.
How to fix it
Use bracket notation
- Replace the dotted access with the bracket form the error shows.
- Apply it to every index-signature access flagged.
- Re-run tsc to confirm TS4111 clears.
const isProd = process.env['NODE_ENV'] === 'production';Type known env keys explicitly
Declare the specific environment variables so they are real properties, not index-signature members.
declare namespace NodeJS {
interface ProcessEnv { NODE_ENV: 'development' | 'production'; }
}How to prevent it
- Use bracket access for index-signature properties.
- Declare known
ProcessEnvkeys to get real property access. - Keep the strict option consistent across environments.