dts-generator icon indicating copy to clipboard operation
dts-generator copied to clipboard

Error: Arguments to path.resolve must be string Use --force to continue.

Open janakerman opened this issue 9 years ago • 6 comments

I'm getting the following error:

Running "dtsGenerator:build" (dtsGenerator) task
Warning: Arguments to path.resolve must be strings Use --force to continue.
Aborted due to warnings.

I've followed the grunt task setup described on your page modifying it slightly to fit my use-case but I'm having no luck:

dtsGenerator: {
    options: {
        name: 'package-name',
        project: 'build/',
        out: 'package-name.d.ts'
    },
    build: {
        src: [ 'build/**/*.ts' ]
    }
}

My TS is compiling as expected into build/src.

janakerman avatar Nov 18 '15 13:11 janakerman

I am having the same problem using almost same code as above. Tried several tricks like using './build' both on project and src, removing the brackets of src, etc... But no luck. Finally, I used command line to get my d.ts file through:

dts-generator --name mylib --project ./ --out mylib.d.ts --exclude "typings/*/.d.ts"

Hope it helps.

francisco-verdugo avatar Dec 11 '15 12:12 francisco-verdugo

I managed to get the task running without errors in grunt by defining a task and running dts-generator programatically:

grunt.task.registerTask('dts', '', function() {
  require('dts-generator').default({
          name: 'package-name',
          project: '.',
          out: 'package-name.d.ts',
          src: [ 'build/**/*.ts' ],
          files: grunt.file.expand(['./src/**/*.ts'])
    });
});

I'm getting package-name.d.ts generated, but it's completely empty.

janakerman avatar Dec 16 '15 11:12 janakerman

Thanks @janakerman , we'll look at this as soon as possible (unfortunately probably not until next week)

dylans avatar Dec 16 '15 11:12 dylans

@janakerman I'm seeing the same error, loading tasks using jit-grunt. Will post if I make any progress.

simonrobb avatar Jan 09 '16 01:01 simonrobb

@janakerman @dylans The error occurs when the baseDir option is undefined. See https://github.com/SitePen/dts-generator/pull/57 for pull request (you can provide an empty string for baseDir in the meantime).

simonrobb avatar Jan 09 '16 01:01 simonrobb

@simonrobb - Thanks for looking into that!

janakerman avatar Jan 13 '16 17:01 janakerman