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

Importing readonly array of standalone components/pipes #48233

Closed
yusijs opened this issue Nov 25, 2022 · 3 comments
Closed

Importing readonly array of standalone components/pipes #48233

yusijs opened this issue Nov 25, 2022 · 3 comments

Comments

@yusijs
Copy link

yusijs commented Nov 25, 2022

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

Yes

Description

I think this is a regression of #47643, but not 100% sure since the related PR talks about component.Imports

As described in the docs, I have published a library where I'm deprecating my modules, and exporting them as Arrays for as an interrim solution:

export const DirectivesModule = [
  QuickKeysDirective
  , DateFormFieldClickDirective
....
] as const;

This gives me ts-error TS2322, which seems correct since the type definition for imports looks like this:
imports?: Array<Type<any> | ModuleWithProviders<{}> | any[]>;
but the type from the compilation is readonly [typeof QuickKeysDirective, typeof DateFormFieldClickDirective]

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

TS2322: Type 'readonly [typeof QuickKeysDirective, typeof DateFormFieldClickDirective]' is not assignable to type 'any[] | Type<any> | ModuleWithProviders<{}>'.   The type 'readonly [typeof DateFormatPipe, typeof KeysPipe, typeof NumberFormatPipe, typeof CurrencyFormatPipe, typeof GetUnit, typeof ExcludeUnit, typeof YesNoPipe]' is 'readonly' and cannot be assigned to the mutable type 'any[]'.

Please provide the environment you discovered this bug in (run ng version)

Using nx, so not able to run ng version for some reason, but:

    "@angular/animations": "15.0.1",
    "@angular/cdk": "15.0.0",
    "@angular/common": "15.0.1",
    "@angular/compiler": "15.0.1",
    "@angular/core": "15.0.1",
    "@angular/forms": "15.0.1",
    "@angular/material": "15.0.0",
    "@angular/material-date-fns-adapter": "15.0.0",
    "@angular/platform-browser": "15.0.1",
    "@angular/platform-browser-dynamic": "15.0.1",
    "@angular/router": "15.0.1",
    "@angular/service-worker": "15.0.1",

Anything else?

No response

@JoostK
Copy link
Member

JoostK commented Nov 25, 2022

Duplicate of #48089.

@JoostK JoostK closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2022
@yusijs
Copy link
Author

yusijs commented Nov 25, 2022

jesus how did I not find that when I searched 🤦 thanks @JoostK

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants