tsframework / ts-framework

A Web Framework for Nodejs
http://tsframework.github.io
MIT License
43 stars 6 forks source link

TSFramework.d.ts not found #6

Closed petrck closed 8 years ago

petrck commented 8 years ago

Hi, first of all, great project! Thank for it. I have problem, after run tsfw start :

[11:24:21] Starting 'ts:build'...
app.ts(2,1): error TS6053: File '/Users/petrtomasek/Projects/HelloWordTSF/node_modules/ts-framework/build/TSFramework.d.ts' not found.
app/Global.ts(2,10): error TS2304: Cannot find name 'require'.
app/Global.ts(3,12): error TS2304: Cannot find name 'require'.
app/Global.ts(4,40): error TS2304: Cannot find name '__dirname'.
app/controllers/HomeController.ts(6,14): error TS2339: Property 'view' does not exist on type 'HomeController'.
[11:24:25] TypeScript: 5 semantic errors
[11:24:25] TypeScript: emit succeeded (with errors)
[11:24:25] Finished 'ts:build' after 4.08 s 

So, i tried reference tsd.d.ts file and output was changed to this:

[11:29:47] Starting 'ts:build'...
app/controllers/HomeController.ts(3,30): error TS2507: Type 'any' is not a constructor function type.
app/controllers/HomeController.ts(6,14): error TS2339: Property 'view' does not exist on type 'HomeController'.
[11:29:52] TypeScript: 2 semantic errors
[11:29:52] TypeScript: emit succeeded (with errors)
[11:29:52] Finished 'ts:build' after 4.64 s

I suppose, TSFramework.d.ts define TS to use TS.Controller? By the way, I tested compile this project with gulp and tsconfig:

My gulpfile:

...
...
var tsProject = ts.createProject('tsconfig.json', { typescript: require('typescript') });

gulp.task('ts:build', function () {
    return tsProject.src(['app.ts'])
        .pipe(plumber())
        .pipe(sourcemaps.init())
        .pipe(ts(tsProject))
        .pipe(sourcemaps.write("."))
        .pipe(gulp.dest('./build/app.js'));
});

gulp.task('tscompile:watch', function () {
    gulp.watch(['app.ts'], ['ts:build']);
});

gulp.task('default', ['ts:build']); 

and tsconfig.ts

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "Scripts",
    "node_modules"    
  ]
}

Implementation from previous issue (from Paradoxis ) works fine :-) I look forward to next version!

jhonmike commented 8 years ago

please, update tsfw-cli for version 0.1.9

the framework is receiving several updates, it will generate several errors to a stable versiona, 1.0.0

jhonmike commented 8 years ago

@petrck could remove grunt.js and add to gulp.js the ts-framework and ts-generate-app project?

petrck commented 8 years ago

@jhonmike yes, it is possible, but I'm solving one more problem with compilator. Compilation not working fine for me. (with gulp and grunt too). Problem is here: statement Import * {...} Using CommonJS, this should be translated like required, if I'm not misktaken. But for some reason it is not and node js throw parseError You it works well? Thanks.

jhonmike commented 8 years ago

@petrck: I understand, instead of using import from {} ... should use import Controller = require(...), I am also having this problem, only I spoke of gulp.js to have a syntax of the most beautiful task!

about the error, @Paradoxis managed to solve the framework, more in general that customer can not, I believe I have with Jison, remembering that I am not the creator of the framework, just been trying to keep him organized and updated!