getcursor / cursor

The AI-powered code editor
https://cursor.sh
20.57k stars 1.38k forks source link

When using <Text> in react native, auto import does not work, because of the Text interface declartation in lib.dom.d.ts #1438

Open Johann01 opened 1 month ago

Johann01 commented 1 month ago

When using in react native, there is a type error coming up referring to this interface:

/**
 * The textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children.
 *
 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Text)
 */
interface Text extends CharacterData, Slottable {
    /**
     * Returns the combined data of all direct Text node siblings.
     *
     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Text/wholeText)
     */
    readonly wholeText: string;
    /**
     * Splits data at the given offset and returns the remainder as Text node.
     *
     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Text/splitText)
     */
    splitText(offset: number): Text;
}

in /Applications/Cursor.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts

Instead of the native Text Component in react native

1) If you can, please include a screenshot of your problem Screenshot 2024-05-08 at 16 41 32 2) Please include the name of your operating system macOS 14.2 (23C64) 3) If you can, steps to reproduce are super helpful

  1. Run npx create-expo-app StickerSmash.
  2. Go into StickerSmash/app/(tabs)/explore.tsx
  3. Type into the JSX Explore
  4. See the Type Error coming up.