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

TS types are missing from built npm package #748

Closed
Temzasse opened this issue Aug 9, 2024 · 7 comments
Closed

TS types are missing from built npm package #748

Temzasse opened this issue Aug 9, 2024 · 7 comments

Comments

@Temzasse
Copy link

Temzasse commented Aug 9, 2024

Hi 👋🏻

When importing this library the TS types are not found:

Screenshot 2024-08-09 at 13 27 15

It seems that the TS types are not part of the packaged library artefact: https://www.npmjs.com/package/ical.js?activeTab=code

I tried to clone and build the lib locally and the types are generated just fine so the problem is probably related to the npm publishing phase.

Thanks in advance!

@Temzasse
Copy link
Author

Temzasse commented Aug 9, 2024

Actually I noticed that the generated module.d.ts file is maybe importing things from the wrong places:

import Binary from "./binary.js";
import Component from "./component.js";
import ComponentParser from "./component_parser.js";
import Duration from "./duration.js";
import Event from "./event.js";
import Period from "./period.js";
import Property from "./property.js";
import Recur from "./recur.js";
import RecurExpansion from "./recur_expansion.js";
import RecurIterator from "./recur_iterator.js";
import Time from "./time.js";
import Timezone from "./timezone.js";
import TimezoneService from "./timezone_service.js";
import UtcOffset from "./utc_offset.js";
import VCardTime from "./vcard_time.js";
import parse from "./parse.js";
import stringify from "./stringify.js";
import design from "./design.js";
import * as helpers from "./helpers.js";

Should it import from the .ts extension?

@NotWoods
Copy link

NotWoods commented Sep 2, 2024

It should not be importing from the .ts extension, TypeScript writes imports with .js so the strings don't need to be transformed when transpliling.

@dvnrsn
Copy link

dvnrsn commented Sep 5, 2024

Maybe what Temzasse is referring to how the JS files are not in /dist/types but are being referenced as relative to file in the same dir. The individual type files (e.g., helpers.d.ts) themselves reference out to the JS files "sources":["../../lib/ical/helpers.js"]

For me I'm seeing Could not find a declaration file for module './design.js'. on file imports in node_modules/ical.js/lib/ical/module.js

The types are defined only in JSDoc and need accompanying .d.ts, no?

What I find strange is that when I run jsdoc, it doesn't generate files with the expected TS declaration extension.

@kewisch
Copy link
Owner

kewisch commented Sep 11, 2024

I merged two PRs that might have fixed this issue. Once I get a go-ahead from @jannikac I will spin a new release to make it available on npm. Could anyone having issues here try again with the latest code from main?

@kewisch kewisch added the needinfo More information has been requested label Sep 11, 2024
@VladCuciureanu
Copy link

This fixed it for me.

@github-actions github-actions bot removed the needinfo More information has been requested label Sep 11, 2024
@kewisch
Copy link
Owner

kewisch commented Sep 11, 2024

Super, thanks for reporting back. @Temzasse if this is not fixed for you please feel free to reopen or file a new issue.

@kewisch kewisch closed this as completed Sep 11, 2024
@kewisch
Copy link
Owner

kewisch commented Sep 12, 2024

The types have been released as part of version 2.1.0 which is now available on npm.

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

5 participants