remarkablemark/html-react-parser

Migrate to TypeScript

ssi02014 opened this issue ยท 8 comments

Hello, ๐Ÿ‘ @remarkablemark
I'm looking at the code inside "lib" and it looks like you're still using "var" to declare most variables.

Do you have any plans to migrate to "let" or "const"?
If there is a plan, I'd like to work on it, but what do you think?

Thanks for opening this issue @ssi02014! I do plan to eventually migrate to TypeScript but that will be a breaking change this for library.

@remarkablemark ๐Ÿ‘
Thanks for the review!
So, am I correct in understanding that you don't need to do the "let/const" migration beforehand?

as-is

// attributes-to-props.js
var reactProperty = require('react-property');
var utilities = require('./utilities');

// https://reactjs.org/docs/uncontrolled-components.html
// https://developer.mozilla.org/docs/Web/HTML/Attributes
var UNCONTROLLED_COMPONENT_ATTRIBUTES = ['checked', 'value'];
var UNCONTROLLED_COMPONENT_NAMES = ['input', 'select', 'textarea'];

var VALUE_ONLY_INPUTS = {
  reset: true,
  submit: true
};

// ...

to-be

// attributes-to-props.js
const reactProperty = require('react-property');
const utilities = require('./utilities');

// https://reactjs.org/docs/uncontrolled-components.html
// https://developer.mozilla.org/docs/Web/HTML/Attributes
const UNCONTROLLED_COMPONENT_ATTRIBUTES = ['checked', 'value'];
const UNCONTROLLED_COMPONENT_NAMES = ['input', 'select', 'textarea'];

const VALUE_ONLY_INPUTS = {
  reset: true,
  submit: true
};

// ...

@ssi02014 Yes if we're using TypeScript, then we'll be using ES6 syntax.

@remarkablemark
Thanks! ๐Ÿ‘๐Ÿ‘๐Ÿ‘

@remarkablemark any updates on the progress here?

@kasperaamodt No update at the moment. I've been pretty busy so I haven't had a chance to work on this.

Release:

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰