ts-transform-inferno icon indicating copy to clipboard operation
ts-transform-inferno copied to clipboard

Idea: Auto optimize feature

Open Havunen opened this issue 6 years ago • 0 comments

Hi,

Lately I have been thinking that it would be cool, if we could automatically add optimization flags. Can we detect type information in this plugin?

For example if we have simple use case like this:


function translateText(): string {
   return 'Okay!'
}

// Could we automatically flag this vNode with $HasTextChildren? because we know translateText always returns string
const div = <div>{translateText()}</div>;

This could be used for another vNode, numeric values, strings, nulls?. Lists might be problematic because there we need to know if its keyed or not.

Havunen avatar Oct 16 '18 20:10 Havunen