react-native-community / react-native-template-typescript

👾 Clean and minimalist React Native template for a quick start with TypeScript.
https://www.npmjs.com/package/react-native-template-typescript
MIT License
1.86k stars 398 forks source link

Typescript displays wrong messages. #285

Closed yancaidev closed 1 year ago

yancaidev commented 2 years ago

Expected results

The snippet below is the code of the AssetsScreen.tsx file.

import { Text, View } from 'react-native';
import React, { Component } from 'react';

export default class AssetsScreen extends Component {
  render() {
    return (
      <View>
        <Text>AssetsScreen</Text>
      </View>
    );
  }
}

Expecting typescript does not display the error message "Operator '<' cannot be applied to the types 'View' and 'RegExp'".

But it's strange that some other components don't have the same problem.

Observed results

image image

Steps to reproduce

  1. npx react-native init rn_wallet --template react-native-template-typescript.
  2. yarn start
  3. yarn android
  4. Create a directory "src" in the root directory of the project.
  5. Create an "AssetsScreen.tsx" and write down the component code.

Environment