knockout / tko

🥊 Technical Knockout – The Monorepo for Knockout.js (4.0+)
http://www.tko.io
Other
274 stars 34 forks source link

New features has TKO? #99

Open Eisenspalter opened 5 years ago

Eisenspalter commented 5 years ago

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

nmocruz commented 5 years ago

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.

brianmhunt commented 5 years ago

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,
    }],
]