Skip to content

Property 'lens' does not exist on type 'ReadOnlyAtom<State>' #85

Description

@sbahir

I found this codesandbox that was shared by a Grammarly in an engineering post

In line 89 and 90, there is a Typescript compilation error

  const alerts = props.state.lens("alerts");
  const highlights = props.state.lens("highlights");

Property 'lens' does not exist on type 'ReadOnlyAtom<State>'

The code still works but I was intrigued by that knowing that method lens doesn't seem to appear in ReadOnlyAtom as reference here

Can someone explain what I could be missing here?

Should the object be Atom instead of ReadOnlyAtom?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions