matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

TS Conversion: browser-index, errors

Open dbkr opened this issue 3 years ago • 1 comments

Misc little TS conversions: src/browser-index.js and src/errors.js

dbkr avatar Sep 08 '21 15:09 dbkr

Hi @dbkr , I was planning to take on the task of converting src/error.js to TS. While examining the file, I found that there were some constructor functions which were using Reflect to kind of create extended Error classes.

The reason for not using ES6 classes was for backward compatibility (as written here) but I don't think there is a proper way to Typescriptify these constructor functions. Also, in the Contribution.md file, Code Style section, it is mentioned that this project aims to target ES6.

So, my question is should I convert these constructor functions to ES6 classes? In my opinion, the code gets alot more easier to understand this way. Also, the support of Reflect and ES6 classes came almost at a similar time in most of the browsers (Chrome added both of them together in v49).

ryushar avatar Jan 20 '22 12:01 ryushar