Using both coffeescript and typescript in the same project

I am really trying to work with both coffeescript and typescript in the same project.

In fact, I want to choose which one I prefer when coding.

The thing is, javascript generated by typescript doesn't seem to work properly with javascript generated using coffeescript

Explanation:

I wrote a Controller class with coffeescript that works great when I expand it in a coffeescript file, as shown below:

Controller = require('../node_modules/Controller/Controller')

class HelloController extends Controller

  indexAction: (name) =>
     console.log 'hey '+ name

module.exports = HelloController

But when I try to use it with typescript as below:

import Controller = require('../node_modules/Controller/Controller');

export class HelloController extends Controller {

    constructor() {
        super()
    }

    indexAction(name:String) {
        console.log('hey '+name);
    }
}

I received an error message indicating that the controller cannot find in the expected location (the .js file is well generated)

Can you help me?

+4
1

, JavaScript, Coffeescript.

Controller.d.ts, , TypeScript .

:

declare class Controller {
    protected name: string;
    //... more type information
}

export = Controller;

, , , JavaScript Coffeescript, , , , Coffeescript, .d.ts, Coffeescript, ( .d.ts ).

API.

+4

All Articles