Skip to content

fix(error): replace 'parsed: any' with unknown + readField helper (#361) - #406

Open
jdjioe5-cpu wants to merge 1 commit into
FlowwStar:mainfrom
jdjioe5-cpu:fix/issue-361-any-unknown
Open

fix(error): replace 'parsed: any' with unknown + readField helper (#361)#406
jdjioe5-cpu wants to merge 1 commit into
FlowwStar:mainfrom
jdjioe5-cpu:fix/issue-361-any-unknown

Conversation

@jdjioe5-cpu

Copy link
Copy Markdown

Closes #361. Replaces parsed: any with unknown + a narrow readField(obj, keys) helper. No behavior change; drops the eslint-disable line.

…owwStar#361)

Closes FlowwStar#361.

- app/error.tsx: remove the eslint-disable no-unsafe-assignment on
  parsed: any.
- Type JSON.parse(trimmed) as unknown, narrow to object via typeof, and
  walk it via a new readField(obj, keys) helper that returns the first
  defined non-null value across a candidate key list.
- Use it for both code (code / error_code / err) and detail (message /
  error / reason / detail). Existing precedence is preserved.

No behavior change for well-formed RPC error payloads; the file no
longer requires the lint suppression.
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

Successfully merging this pull request may close these issues.

good first issue: replace 'parsed: any' in app/error.tsx with unknown + type guards

1 participant