tko icon indicating copy to clipboard operation
tko copied to clipboard

New features has TKO?

Open Eisenspalter opened this issue 6 years ago • 2 comments

Which new features, something like native JSX/TSX support or Decorators does TKO offer?

Eisenspalter avatar Apr 22 '19 08:04 Eisenspalter

I saw some jsx stuff here. Seems like the TSX is dependent on the typescript support, I was trying to used it, but seems like is missing some typing support, that was started and not sure if completed. about decorators there's a nice library that I'm using https://github.com/gnaeus/knockout-decorators, not sure if some ideas could be native supported by tko as separated module.

nmocruz avatar Apr 25 '19 19:04 nmocruz

TKO has native JSX support now. The transpiler (webpack, babel, typescript) needs to use ko.jsx.createElement and ko.jsx.Fragment for the respective React equivalents (React.createElement and React.Fragment).

For example, in Babel, this would look like:

plugins: [
    ["@babel/plugin-transform-react-jsx", {
      "useBuiltIns": true,
      "pragma": "ko.jsx.createElement",
      "pragmaFrag": "ko.jsx.Fragment",
      "throwIfNamespace": false,
    }],
]

brianmhunt avatar Jul 02 '19 13:07 brianmhunt