Skip to content

Validate that types field is on a TypeScript entrypoint (behind a flag) #259

Open

Description

@Andarist

It's not automatically generated, but even if manually added then it's not validated and cannot be fixed with preconstruct fix.

Activity

  1. Andarist commented on Feb 17, 2020

    @Andarist
    MemberAuthor

    Ok, seems like .d.ts is actually generated - but because of the issue mentioned here I was thinking that I was looking at another directory (the root entry).

    I feel however that maybe it should be validated that "types" got used and throw an error on that (in favor of those type files that are auto-generated). This should ofc happen only for TS projects - adding "types" manually should be supported for packages shipping .d.ts without them actually being written in TS.

  2. emmatown commented on Feb 17, 2020

    @emmatown
    Member

    I feel however that maybe it should be validated that "types" got used and throw an error on that (in favor of those type files that are auto-generated). This should ofc happen only for TS projects - adding "types" manually should be supported for packages shipping .d.ts without them actually being written in TS.

    Agreed

  3. changed the title [-]Additional entries don't have "types" generated[/-] [+]Validate that types field isn't on a TypeScript entrypoint[/+] on Jul 12, 2020
  4. hasparus commented on Jan 4, 2021

    @hasparus

    Hey folks, what's the status of "types" field in package.json with Preconstruct? (BTW Preconstruct is blazing fast. Wow.)

    TypeScript docs advise to add "types" key to package.json. Should preconstruct fix add it to point to the generated .cjs.d.ts file?

  5. emmatown commented on Jan 5, 2021

    @emmatown
    Member

    There's no real need since TypeScript can already resolve it. Is there are a particular reason you want to add it to the package.json?

  6. Andarist commented on Jan 5, 2021

    @Andarist
    MemberAuthor

    Even to make it easier for other tools. For example, npm marks packages with TS types with a special badge. Compare:

  7. hasparus commented on Jan 5, 2021

    @hasparus

    Is there are a particular reason you want to add it to the package.json?

    What Andarist said, and I vaguely remember PRing/patching niche libraries I wanted to use, because old TS couldn't resolve it.

  8. changed the title [-]Validate that types field isn't on a TypeScript entrypoint[/-] [+]Validate that types field is on a TypeScript entrypoint (behind a flag)[/+] on Jan 20, 2021
  9. emmatown commented on Jan 20, 2021

    @emmatown
    Member

    Okay, sounds good. Happy to accept a PR adding this(behind a flag for now because it would be a breaking change otherwise)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions