Mattermost-server: Migrate 'components/post_view/post_body_additional_content' module and associated tests to TypeScript

Created on 14 Sep 2020  路  4Comments  路  Source: mattermost/mattermost-server

We are starting to migrate the mattermost-webapp over to TypeScript to facilitate better code quality. This Help Wanted issue is to modify all files in components/post*view/post_body_additional*content (not sub-directories included) and associated test files.

Below is a checklist of items you should be doing to migrate:

  • < ] Rename the files to their associated TypeScript extensions (ie. js to ts, jsx to tsx)
  • [ ] Update any components using those to the correct imports
  • [ > Fix any errors generated by the TypeScript compiler. You can run make check-types to display any errors.

We are aiming to be as strict as possible for the time being, but if you run into any issues where the file cannot be successfully migrated without significant change in other libraries, or our tsconfig.json, please feel free to raise them as we are aiming to keep this process smooth and gradual, while enforcing as much as we can.

Some examples of already migrated files can be found here:


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-20481

AreTechnical Debt Easy Good First Issue Hacktoberfest Help Wanted PR Exists TecTypeScript

Most helpful comment

Thanks @hanzei @devinbinnie

I did convert post_attachment_opengraph (see https://github.com/mattermost/mattermost-webapp/pull/6669) which in fact needs some mattermost-redux changes (see https://github.com/mattermost/mattermost-redux/pull/1252)

I'll rebase this work on those once accepted 馃憤

All 4 comments

Hello, I'll try to take care of this one :+1:

Hello,

I'll need a little bit of help here.

I'm mostly done with that issue, unfortunately when converting to TS, tsc errors out on

components/post_view/post_body_additional_content/post_body_additional_content.tsx:113:18 - error TS2739: Type '{ link: string; isEmbedVisible: boolean | undefined; post: Post; toggleEmbedVisibility: () => void; }' is missing the following properties from type 'InferPropsInner<Pick<{ link: Validator<string>; currentUserId: Requireable<string>; post: Requireable<object>; openGraphData: Requireable<object>; ... 4 more ...; actions: Validator<...>; }, RequiredKeys<...>>>': actions, enableLinkPreviews, previewEnabled

It seems the connect() call in components/post_view/post_attachment_opengraph/index.js infer return types of mapStateToProps and mapDispatchToProps and mark every props as required

Should I also convert post_attachment_opengraph to ts or is there something more subtle that I missed ?

PR marked as draft in the meantime

Regards,
Nicolas

@devinbinnie Could you please help with :point_up:?

Thanks @hanzei @devinbinnie

I did convert post_attachment_opengraph (see https://github.com/mattermost/mattermost-webapp/pull/6669) which in fact needs some mattermost-redux changes (see https://github.com/mattermost/mattermost-redux/pull/1252)

I'll rebase this work on those once accepted 馃憤

Was this page helpful?
0 / 5 - 0 ratings