Lorp / samsa

Variable font inspector
https://lorp.github.io/samsa/
Apache License 2.0
243 stars 23 forks source link

ES6 / TypeScript support on samsa-core.js #67

Closed tomasdev closed 3 years ago

tomasdev commented 3 years ago

Even though there are no plans to move Samsa to TS (https://github.com/Lorp/samsa/issues/41) it would be fair if the constructor was a proper ES6 class, which would make it TypeScript-compatible.

For those wanting to use the library in TypeScript right now, they must use // @ts-ignore on any new SamsaFont() call (and perhaps elsewhere)

Additionally, the library does not work under JS strict-mode ('use strict';)

I'd like to leave this issue open until someone contributes a PR for it.

Lorp commented 3 years ago

I’d like to understand more about the pros and cons of switching to ES6 classes. When I looked into it some time ago I read about issues that put me off, including problems with minification, performance and more (Please stop using classes in JavaScript, Classes confuse both people and machines).

Regarding 'use strict', I should fix that.

Lorp commented 3 years ago

Closing this, as the balance (AFAIKT) does not favour switching to ES6 classes. "use strict" is now separate issue #68.