Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript types are likely incorrect #270

Open
ericmorand opened this issue Oct 31, 2020 · 4 comments
Open

TypeScript types are likely incorrect #270

ericmorand opened this issue Oct 31, 2020 · 4 comments

Comments

@ericmorand
Copy link

Compiling, then running the following TypeScript module output undefined:

import tsify from "tsify";

console.log(tsify); // undefined

Of course, passing tsify to Browserify would throw a Cannot find module 'undefined' error.

@ericmorand
Copy link
Author

@brianloveswords , you may be interested. I see that you fixed the typings some months ago.

@ericmorand
Copy link
Author

I think this types definition is the correct one:

// Note that @types/browserify is not used for a reason:
// https://github.com/TypeStrong/tsify/issues/267

import * as typescript from "typescript";

declare namespace tsify {
	export interface Options {
		exclude?: string[];
		files?: string[];
		global?: boolean;
		include?: string[];
		m?: string;
		p?: string | Record<string, any>;
		project?: string | Record<string, any>;
		t?: string;
		typescript?: string | typeof typescript;
	}

}

declare var tsify: (b: any, opts: tsify.Options) => any;

export = tsify;

@ericmorand
Copy link
Author

Also, jsx is missing in Options defintion. As most TypeScript CompilerOptions properties.

@cartant
Copy link
Contributor

cartant commented Nov 1, 2020

I think this types definition is the correct one: ...

Yeah, you are right. If you want to open a PR for the change, that would be appreciated.

As most TypeScript CompilerOptions properties.

IMO it's unrealistic to support every project and compiler option via command line and plugin options. Use a tsconfig.json file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants