Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Fix #55: missing TypeScript declarations in packaged output#111

Merged
pooyaj merged 1 commit intosegmentio:masterfrom
BeeMyDesk:fix-typescript-output
Nov 10, 2020
Merged

Fix #55: missing TypeScript declarations in packaged output#111
pooyaj merged 1 commit intosegmentio:masterfrom
BeeMyDesk:fix-typescript-output

Conversation

@frankie567
Copy link
Copy Markdown
Contributor

@frankie567 frankie567 commented Jul 15, 2020

Hi there!

When installing this library in a TypeScript project, the compiler complains that declarations are missing ; while this library is written in TS (see #55).

This PR should address this issue by generating .d.ts files in dist and correctly declare it in packages.json.

Cheers!

@frankie567 frankie567 force-pushed the fix-typescript-output branch from c3b84ea to e3de1f8 Compare July 16, 2020 07:16
@frankie567
Copy link
Copy Markdown
Contributor Author

Could you look into this? It's very annoying when using the library in a TypeScript project...

@pooyaj pooyaj self-requested a review November 10, 2020 01:08
@pooyaj pooyaj merged commit 54b20f5 into segmentio:master Nov 10, 2020
@pooyaj
Copy link
Copy Markdown
Contributor

pooyaj commented Nov 10, 2020

@frankie567 Thanks for the PR! Merged and published a new version ( 5.0.2 )

@kilinkis
Copy link
Copy Markdown
Contributor

I'm still experiencing this issue on version 5.1.0

kilinkis added a commit to kilinkis/consent-manager that referenced this pull request Nov 20, 2020
There is no `src` directory under the `types` directory, so the declarations were failing.
This PR points to the correct file.

Related to [segmentio#111](segmentio#111).

kudos to my colleague @mrseanbaines who noticed the path was wrong.
@ItsWendell
Copy link
Copy Markdown

The bug fix by @kilinkis is great! Until that is released I found this work around worked for me:

file: src/types/@segment/consent-manager.d.ts

declare module "@segment/consent-manager" {
  export * from "@segment/consent-manager/types/index";
}

@mantissa7
Copy link
Copy Markdown

mantissa7 commented Aug 23, 2021

The issue seems now to be (in version 5.2.0) that the package.json is pointing in the wrong place for the declaration file. Changing line 15 from "types": "types/src/index.d.ts", to "types": "types/index.d.ts", fixed the issue for me as there is no types/src folder in the packaged output. Until #126 is merged #111 (comment) is a workaround.

nd4p90x added a commit that referenced this pull request Sep 9, 2021
There is no `src` directory under the `types` directory, so the declarations were failing.
This PR points to the correct file.

Related to [#111](#111).

kudos to my colleague @mrseanbaines who noticed the path was wrong.

Co-authored-by: Shane L. Duvall <shane@northtwofive.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants