> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-unsafe-member-access

[Added in v0.1.4](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.4)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ ts.configs.recommendedTypeChecked | `"error"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/no-unsafe-member-access': 'error',
    },
  },
]);
```

## Rule Details

Disallow member access on a value with type `any`.

Accessing a member (property or element) on an `any`-typed value is unsafe because the result will also be typed as `any`, propagating the lack of type safety. This rule flags both dot-notation property access and bracket-notation element access on `any`-typed values, as well as computed member access where the index expression is typed as `any`.

Examples of **incorrect** code for this rule:

```typescript
declare const anyVal: any;
anyVal.foo;
anyVal['bar'];
anyVal[0];

declare const key: any;
declare const obj: { [k: string]: number };
obj[key];
```

Examples of **correct** code for this rule:

```typescript
declare const obj: { foo: string };
obj.foo;

declare const arr: string[];
arr[0];

declare const key: string;
declare const map: { [k: string]: number };
map[key];
```

Optional chaining on `any` remains unsafe by default. Set
`allowOptionalChaining` to `true` to allow only the access link containing
`?.`:

```json
{
  "@typescript-eslint/no-unsafe-member-access": [
    "error",
    { "allowOptionalChaining": true }
  ]
}
```

```typescript
declare const value: any;
const result: unknown = value?.property;
```

## Original Documentation

- [typescript-eslint: no-unsafe-member-access](https://typescript-eslint.io/rules/no-unsafe-member-access)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts)
