Skip to content

TypeScript types are likely incorrect #270

Open

Description

@ericmorand

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.

Activity

  1. ericmorand commented on Oct 31, 2020

    @ericmorand
    Author

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

  2. ericmorand commented on Oct 31, 2020

    @ericmorand
    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;
  3. ericmorand commented on Oct 31, 2020

    @ericmorand
    Author

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

  4. cartant commented on Nov 1, 2020

    @cartant
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy