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

Please type this package #33

Open
tsteuwer opened this issue Feb 4, 2025 · 3 comments
Open

Please type this package #33

tsteuwer opened this issue Feb 4, 2025 · 3 comments
Labels
Type: Enhancement Issue contains an enhancement related to a specific module. Additional functionality has been add

Comments

@tsteuwer
Copy link

tsteuwer commented Feb 4, 2025

I don't know where to post this, so I'm posting this here since this is an actual issue within this package.

As a developer, it is extremely frustrating that I get no help when importing this library via @primeng/themes because everything is set to any. All definitions that come in resemble this from the package:

import * as _primeuix_utils_eventbus from '@primeuix/utils/eventbus';

declare function definePreset(...presets: any[]): any;

declare function updatePreset(...presets: any[]): any;

declare function updatePrimaryPalette(primary?: any): any;

declare function updateSurfacePalette(palette?: any): any;

declare function usePreset(...presets: any[]): any;

declare function useTheme(theme: any): any;

If I want to define a preset, I have no idea what properties I can set, if what I wrote is valid, or what's available to me unless I specifically go look at presets already created by PrimeFaces. This package might as well be straight JavaScript instead of TypeScript.

I think there needs to be an overall shift within PrimeFaces, though I don't know where to bring this up, that the overuse of any has gotten out of hand and degrades the developer experience when using their packages.

Please provide types, thanks!

@mertsincan
Copy link
Member

Thank you so much for your feedback. To be honest, we made quite a few changes within the packages, which required quick code updates. Right now, everything is stable, but we still need to review and refine the types a bit more. In the latest update, I’ve revised the definitions of the methods mentioned above. I'll improve this further in the next versions.

@mertsincan mertsincan added the Type: Enhancement Issue contains an enhancement related to a specific module. Additional functionality has been add label Feb 17, 2025
@Exac
Copy link

Exac commented Feb 21, 2025

If it helps, you can get strong typing when extending themes like so:

import { definePreset, palette } from '@primeng/themes';
import Lara from '@primeng/themes/lara';
import { ThemeType } from 'primeng/config';

export const myCompanyThemePreset: ThemeType = definePreset(Lara, {
  primitive: { blue: palette('#0000FF') }
} satisfies typeof Lara);

@md-f
Copy link

md-f commented Mar 4, 2025

Hi, I'm using @primeng/themes that imports primeuix

Just wanted to add that this package doesn't even compile if I use typescript 5.8.2, I was testing it because now Angular 19.2 supports typescript 5.8, and it gives me [ERROR] TS2307: Cannot find module '@primeuix/utils/eventbus' or its corresponding type declarations. [plugin angular-compiler] for the file node_modules/@primeng/themes/node_modules/@primeuix/styled/index.d.mts)

Everything works if I add a // @ts-ignore on top of the file, or if I downgrade my project to typescript 5.7.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific module. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

4 participants