bjatkin/KISSjs

Type Script support

Closed this issue · 3 comments

Currently kiss supports coding in JS only, if TS was also supported it would make working with TS much easer as kiss handles the bundling nicely. This could also allow the use of TS inside components which would be nice. It also seems like it wouldn't require much effort as unlike javascript you don't have to worry about the semi-colon problem and TS files have a more definite import syntax.

I've begun working on this and have added basic typescript parsing. Suggested syntax for <script> tags is presented below.

<script type="text/typescript">
    // TS code here
</script>

Also, we support default e6s import syntax for imports now meaning that import code works both with kiss and with TS tooling.

// this is allowed
import {module1, module2} from '../util/util'

all ts imports are assumed to be .ts files for now.

also of note, ts does not currently support the remote keyword as it's use case is unclear to me. Including the remote keyword on a type script tag will result in a compiler error once the feature is done.

closed by accident XD

type script is now fully supported. If type script files are included a bundle.ts file will built by the compiler and a bundle.js link will be added to the index.html file. You can see the branch that implemented this feature here

As mentioned above es6 import statements should be used to import files and setting the text attribute of a script tag will identify the inner/ linked code as typescript. Users will need to install and use the Typescript compiler on their own in order to take the bundle.ts file to a final bundle.js file