Warning: Multiple pipes match the name 'date' in the 'component name' component. Check the...

Discussão em 'Angular' iniciado por Deepa Shetty, Fevereiro 26, 2025.

  1. Deepa Shetty

    Deepa Shetty Guest

    Warning: Multiple pipes match the name 'date' in the 'component name' component. Check the imports of this module.

    After angular 19 upgrade it is observed that we get warning when we use the same name of the ng built in pipe as our custom pipe name by extending the built in pipe due to below implementation in angular core.

    Any reason why we are not allowing the user to override the built in pipes from angular core with the same name??

    We were using a Polymorphism mechanism to inherit the built in date pipe and have created our own custom pipe with the same name 'date'. But after angular upgrade we see the below warning getting displayed in the dev mode.

    /**
    * Searches the pipe registry for a pipe with the given name. If one is found,
    * returns the pipe. Otherwise, an error is thrown because the pipe cannot be resolved.
    *
    * @param name Name of pipe to resolve
    * @param registry Full list of available pipes
    * @returns Matching PipeDef
    */
    function getPipeDef(name, registry) {
    if (registry) {
    if (ngDevMode) {
    const pipes = registry.filter(pipe => pipe.name === name);
    // TODO: Throw an error in the next major
    if (pipes.length > 1) {
    console.warn(formatRuntimeError(313 /* RuntimeErrorCode.MULTIPLE_MATCHING_PIPES */, getMultipleMatchingPipesMessage(name)));
    }
    }
    for (let i = registry.length - 1; i >= 0; i--) {
    const pipeDef = registry;
    if (name === pipeDef.name) {
    return pipeDef;
    }
    }
    }
    if (ngDevMode) {`your text`
    throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
    }
    return;
    }

    Continue reading...

Compartilhe esta Página