Skip to content

Bug: (typescript) LexicalNode types are missing the append method #5502

Closed

Description

@atomrc

Lexical version: 0.12.6

Steps To Reproduce

  1. wire this piece of code in a TypeScript context
    lexicalEditor.update(() => {
      const root = $getRoot().getLastChild()!;
      const textNode = $createTextNode(text);
      root.append(textNode);
    });

Link to code example:

The current behavior

The following TypeScript error occurs

Property 'append' does not exist on type 'LexicalNode'.

The expected behavior

No TypeScript error should be thrown (works with version 0.12.5)

Activity

  1. cdzombak commented on Jan 18, 2024

    @cdzombak

    I'm seeing this as well with 0.12.6.

  2. Grantoed commented on Jan 29, 2024

    @Grantoed

    Same with getFirstChild()

  3. grigoriy-reshetniak commented on Jun 6, 2024

    @grigoriy-reshetniak

    Not reproducible in 0.16.0

  4. 2wheeh commented on Jun 6, 2024

    @2wheeh
    Contributor

    This was probably due to moduleResolution: bundler in tsconfig and fixed since v0.14.3

  5. petejodo commented on Jul 26, 2024

    @petejodo

    can confirm getFirstChild() is missing on LexicalNode in v0.16.1. append is however

    actually disregard my getFirstChild() remark, that may be intended due to #5223

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