How to use the @ngrx/schematics/schematics-core.NoopChange function in @ngrx/schematics

To help you get started, we’ve selected a few @ngrx/schematics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngrx / platform / modules / schematics / src / container / index.ts View on Github external
const stateImportPath = buildRelativePath(componentPath, statePath);
    const storeImport = insertImport(
      source,
      componentPath,
      'Store',
      '@ngrx/store'
    );
    const stateImport = options.state
      ? insertImport(
          source,
          componentPath,
          `* as fromStore`,
          stateImportPath,
          true
        )
      : new NoopChange();

    const componentClass = source.statements.find(
      stm => stm.kind === ts.SyntaxKind.ClassDeclaration
    );
    const component = componentClass as ts.ClassDeclaration;
    const componentConstructor = component.members.find(
      member => member.kind === ts.SyntaxKind.Constructor
    );
    const cmpCtr = componentConstructor as ts.ConstructorDeclaration;
    const { pos } = cmpCtr;
    const stateType = options.state
      ? `fromStore.${options.stateInterface}`
      : 'any';
    const constructorText = cmpCtr.getText();
    const [start, end] = constructorText.split('()');
    const storeText = `private store: Store<${stateType}>`;