Code Monkey home page Code Monkey logo

Comments (5)

timdeschryver avatar timdeschryver commented on May 23, 2024 1

@intigroll this is a TypeScript thingy, see ngrx/platform#3654 for more info

from timdeschryver.dev.

bttb avatar bttb commented on May 23, 2024

Thanks for your articles about ngrx. Unfortunately the createActionGroup does not work together with typescript naming rules. In your example

export const CustomerPageActions = createActionGroup({
    source: "Customers Page",
    events: {
      // Action without props
      'Customers Loaded': emptyProps(),
      // Action with props
      'Customer Detail Opened': props<{ customerId: string }>(),
    },
});

I will get this output from my linter:

   10:14  error  Variable name `CustomerPageActions` must match one of the following formats: camelCase, UPPER_CASE                        @typescript-eslint/naming-convention
   14:5  error  Object Literal Property name `Customers Loaded` must match one of the following formats: camelCase            @typescript-eslint/naming-convention
   16:5  error  Object Literal Property name `Customer Detail Opened` must match one of the following formats: camelCase            @typescript-eslint/naming-convention

The project compiles, but the linter is not happy.

from timdeschryver.dev.

timdeschryver avatar timdeschryver commented on May 23, 2024

@bttb Yea, that's a known quirk.
As a workaround you can declare the events as "normal" properties:

export const CustomerPageActions = createActionGroup({
    source: "Customers Page",
    events: {
      // Action without props
      customersLoaded: emptyProps(),
      // Action with props
      customerDetailOpened: props<{ customerId: string }>(),
    },
});

from timdeschryver.dev.

intigroll avatar intigroll commented on May 23, 2024

@timdeschryver thank you for this article. I struggle while I migrate to new NgRx. I get TypeError: undefined is not an object (evaluating 'this.store.select').

component looking like this:

  public subScriptionAndTarifSelecion$ = this.store.select(
    headNavigationFeature.selectHeadNavigationState,
  );

  public constructor(private readonly store: Store) { }

Everything is following this migration guide. Any suggestions?

from timdeschryver.dev.

intigroll avatar intigroll commented on May 23, 2024

@timdeschryver never mind I found a solution.

  public subScriptionAndTarifSelecion$!: Observable<boolean>;

  public constructor(private readonly store: Store) {
    this.subScriptionAndTarifSelecion$ = this
      .store.select(headNavigationFeature.selectAboTarifSelection);
  }

seems to work.

from timdeschryver.dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.