Generates core.typed annotation files from Closure Library JSDoc annotations.
WIP
From this JavaScript code with annotations,
/**
* @typedef {Array|NodeList|Arguments|{length: number}}
*/
goog.array.ArrayLike;
/**
* Returns the last element in an array without removing it.
* @param {Array.<T>|goog.array.ArrayLike} array The array.
* @return {T} Last item in array.
* @template T
*/
goog.array.peek = function(array) {
return array[array.length - 1];
};closure-tcljs should generates this declaration file (d.clj)
(ns goog.array)
(def-alias ArrayLike (U
(Array any)
NodeList
Arguments
(HMap :mandatory {:length number})
))
(ann peek (All [T] [(U (Array T) goog.array.ArrayLike) -> T]))$ bin/closure-tcljs some-jsdoced-code.js
$ ls
some-jsdoced-code.d.clj
some-jsdoced-code.jsWIP. Not yet usable from core.typed
- Variable with
@type - Function with
@paramand@return - Namespace to tcljs
ns - Classes (
@constructorand@extends) to tcljs datatype - Generic type like
(Array number) - Generic classes and function with
@template - Union type
- Record type
- Rest parameters in
@paramand FunctionType - Exclude
@privatedefinitions @typedef(partialy)- Derive annotations for constructor functions such as
Number.from corresponding classes' constructor - Ignore features core.typed doesn't have
@this,newof function type- Nullable, Non-Nullable
- Interfaces
@lends- Enum with
@enumto TypeScriptInterface - Dependencies of Closure Library files
- Arity overloading with
IFn(Optional Parameters) - One stop build system with Grunt or Gulp
MIT (original repo doesn't have LICENCE.md but package.json says it's MIT)
- Original Work Copyright (c) teppeis https://github.com/teppeis
- Modified Work Copyright 2014 Minori Yamashita ympbyc@gmail.com
TODO: Add LICENSE.md after confirming w/ teppeis