2

Converted my Sails.js app to using TypeScript and when I try to hit my previous routes I'm getting errors around "TypeError: object is not a function".

I created a controller using a Class and re-wrote my functions in TypeScript. At the end I instantiated my new controller doing

var controller = new TestController();
export = controller;

I'm not understanding what I did wrong here. I referenced the work done on http://alexclavelle.blogspot.com/2015/03/using-sailsjs-with-typescript.html?showComment=1435617822375

Still nothing...I'm guessing it is something with the es5 code that gets generated.

1 Answer 1

2

Based on:

var controller = new TestController();
export = controller;

the runtime cannot do controller().

Fix:

var controller = () => new TestController();
export = controller;
Sign up to request clarification or add additional context in comments.

1 Comment

I think this got me farther...though now my routes are all messed up. All of my routes are giving this error in console on sails.js/node.js startup error: Ignored attempt to bind route (/) to unknown controller.action :: index.findthis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.