Typescript support for canJS 3.0?

Typescript become more and more important since angular2 use Typescript as main codebase.

i think we should jump on the train and should support Typescript. What i mean is, we should provide the type definitions for canjs 3.0

if we provide the typing, users from angular2 may find it easier to use canjs. with Typescript we also have the benefit static type-checking and API definition for canjs.

compiling .ts to javscript have to be done in the IDE or gulp. i dont think it is necessary to transpile typescript in the browser.

what do you think?

Id like to provide type definitions, but I’m not a fan of writing CanJS in typescript.

Ideally, we could do typescript in the browser similar to how coffeescript works.

Everything sort of has to run in the browser so modlets can work without making a ton of builds or hosting a special server.

I wonder if documentjs can export typescript definitions.

i think it is a little bit more then just generate typings by documentjs.[quote=“justinbmeyer, post:2, topic:211”]

i saw https://github.com/retro/steal-ts, but to compile typescript in the browser we need a 3MB file. i dont like that idea. also we only get erros (type checking) while compiling typescript. so we need to do this in the IDE.
i think with the introduction of angular2 much programers will know typescript and how to use it. so i dont see any reason for do all the stuff in a blackbox

also i thought about rewriting canjs in typescript. we can remove lot of old stuff like can.Construct which is the base of all. but in ES6 and typescript classes can be extends and have static properties as well. i think in 3.0 or maybe in 4.0 we have to rewrite your codebase. if we do not, we lose the connection

Connection to whom? There are a lot of compile to JS languages (and have been). I don’t see a good reason to bet on Typescript until its ubiquitous.

other frameworks…

we have to provide new experience for users. if we dont do that, the canjs community will fade away… the canjs community is still not that big.
as you said (in the hangout), there are good points for canjs, but are they convincingly to use canjs instead of other frameworks?

@justinbmeyer if you will or not, we have to compete to other frameworks

i will, behind typescript there a global players like google an microsoft.

Compiling with a build script should already work just fine. Let’s say you compile your source to a dist/ folder, if you set:

  "system": {
    "directories": {
      "lib": "dist"

Everything should just work.

sorry @matthewp do not understand what you are saying…

we need to compile typescript with an IDE, if we dont, we didn’t see any compiling error. the typescript compiler checks type-checking and erros while compiling.
the ts-compiler exports typescript file into a commonjs or AMD file.

I’m saying that Steal can import those commonjs/amd modules. You don’t have to compile them in the browser.

Let’s say you compile TS with your IDE, where does it write those files to?

there is a tsconfig.json where you can set compiler options. with outDir you can specifiy an output folder, preferably src. of course steal can import those compiled file in the output folder.

There are lots of ways we can bring a new experience. I’d argue strongly that DoneJS is already. Using someone else’s typed language doesn’t seem to me to be one. We’d be investing a lot of time to follow a sliver of total JS users.

I’d rather prioritize innovation, evangelism, and cleanup of what we have. Chasing popularity shouldn’t be the goal of DoneJS. It should be providing a steady, and rock solid dev experience. Besides, DoneJS is far more powerful than type safety.

If there becomes more typescript users than JS, I’d totally be on board. But there’s also a huge elm contingent right now. I’ve seen more talks on that than typescript lately.

I like typescript, just not enough to think we should adopt it at this time. A few people said we should do coffee a few years ago. Because MSFT and GOOG adopt it doesn’t mean everyone else will.

Are you sure that we couldn’t use DocumentJS to provide a header file? We have practically every signature’s params and return value typed out.

We should definitely have demo projects that use TypeScript though. @pYr0x if you’re interested you could fork a project like place-my-order and rewrite it in TypeScript.

@matthewp that would be awesome, but we’d need to rewrite everything in Typescript or provide a definition file right?

What’s typescript like linking to an undefined library?

@justinbmeyer we need to provide a type definifion file https://github.com/typings/typings

example of import can.Map in typescript

import {canMap} from "can/map/";

type definition can look like

declare module "can/map/" {
 class canMap {
   static extend(args?: any):canMap

but i am stack on the definition… get this error http://stackoverflow.com/questions/13407036/how-does-typescript-interfaces-with-construct-signatures-work?rq=1