Skip to content

All types have to be exported #16

Open
@peter-leonov

Description

@peter-leonov

Type generator is trying to be reliable through not being too smart about your project code base. This also reduces the configuration required for the tool to start generating effective code.

One example of the trade offs made is that all the type aliases used in the source file have to be exported from the same file.

Example:

// Here are the imported types
import { Type1 } from "some-lib-1";
import { Type2 } from "some-lib-2";

// Here we re-export them.
// Please note that this is a type only export.
export { type Type1, type Type2 };

export type MyType = {
  field1: Type1;
  field2: Type2;
};

A good side of this limitation is that there's gonna be no unexpected type leaks. Keep in mind that all the runtime type generators turn compile time only types into real JS code that gets shipped with your bundle and can be examined by others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions