GetStream / stream-chat-react

React Chat SDK ➜ Stream Chat 💬
https://getstream.io/chat/sdk/react/
Other
702 stars 273 forks source link

TS definition errors #780

Closed DamonOehlman closed 3 years ago

DamonOehlman commented 3 years ago

Hey folks - just an update after attempting to do a version upgrade to 4.x.x package (have been sitting on 3.x.x for a while and have been putting off the upgrade). Just having the following TS errors popup:

../../node_modules/stream-chat-react/types/index.d.ts:16:48 - error TS2307: Cannot find module '../src/components/Channel/types' or its corresponding type declarations.

16 import type { ChannelStateReducerAction } from '../src/components/Channel/types';
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:90:14 - error TS2304: Cannot find name 'EmojiMartData'.

90   emojiData: EmojiMartData;
                ~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:93:34 - error TS2304: Cannot find name 'NimblePickerProps'.

93   EmojiPicker: React.ElementType<NimblePickerProps>;
                                    ~~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:94:15 - error TS2304: Cannot find name 'NimbleEmojiIndex'.

94   EmojiIndex: NimbleEmojiIndex;
                 ~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:95:28 - error TS2304: Cannot find name 'NimbleEmojiProps'.

95   Emoji: React.ElementType<NimbleEmojiProps>;
                              ~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:190:29 - error TS2304: Cannot find name 'NimbleEmojiProps'.

190   Emoji?: React.ElementType<NimbleEmojiProps>;
                                ~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:191:15 - error TS2304: Cannot find name 'EmojiMartData'.

191   emojiData?: EmojiMartData;
                  ~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:192:16 - error TS2304: Cannot find name 'NimbleEmojiIndex'.

192   EmojiIndex?: NimbleEmojiIndex;
                   ~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:193:35 - error TS2304: Cannot find name 'NimblePickerProps'.

193   EmojiPicker?: React.ElementType<NimblePickerProps>;
                                      ~~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:748:29 - error TS2314: Generic type 'TextareaHTMLAttributes<T>' requires 1 type argument(s).

748   additionalTextareaProps?: React.TextareaHTMLAttributes;
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1550:11 - error TS2304: Cannot find name 'BaseSyntheticEvent'.

1550   event?: BaseSyntheticEvent,
               ~~~~~~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1618:3 - error TS2411: Property 'commerce' of type 'PinEnabledUserRoles | undefined' is not assignable to string index type 'PinEnabledUserRoles'.

1618   commerce?: PinEnabledUserRoles;
       ~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1619:3 - error TS2411: Property 'gaming' of type 'PinEnabledUserRoles | undefined' is not assignable to string index type 'PinEnabledUserRoles'.

1619   gaming?: PinEnabledUserRoles;
       ~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1620:3 - error TS2411: Property 'livestream' of type 'PinEnabledUserRoles | undefined' is not assignable to string index type 'PinEnabledUserRoles'.

1620   livestream?: PinEnabledUserRoles;
       ~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1621:3 - error TS2411: Property 'messaging' of type 'PinEnabledUserRoles | undefined' is not assignable to string index type 'PinEnabledUserRoles'.

1621   messaging?: PinEnabledUserRoles;
       ~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1622:3 - error TS2411: Property 'team' of type 'PinEnabledUserRoles | undefined' is not assignable to string index type 'PinEnabledUserRoles'.

1622   team?: PinEnabledUserRoles;
       ~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1721:4 - error TS2709: Cannot use namespace 'ReactMarkdown' as a type.

1721 ): ReactMarkdown;
        ~~~~~~~~~~~~~

../../node_modules/stream-chat-react/types/index.d.ts:1790:18 - error TS2304: Cannot find name 'TranslationLanguages'.

1790   userLanguage?: TranslationLanguages;

I'll be investigating this further on my side also, however, at first glance I believe the majority of the above are related to missing imports in the types/index.d.ts file.

gz#10227

DanC5 commented 3 years ago

Hey @DamonOehlman, we're just about ready to publish a major version release with full TypeScript support. Look for it within the next week or so. At that point all of these outstanding type issues should be handled. I'm going to close this issue since we're not planning to make any patch releases to fix old types within the next couple days, but do let us know if you still encounter any type issues after the entire library has been converted to TypeScript. Thanks!

DanC5 commented 3 years ago

Also, the upgrade to TypeScript support will be non-breaking, so upgrading shouldn't be a pain.

DamonOehlman commented 3 years ago

@DanC5 absolutely cool with you closing the issue - looking forward to that next release 🎉