Skip to content

bug: angular-output-target emitting invalid syntax 1/2 #699

@Hugh-Ryan

Description

@Hugh-Ryan

Prerequisites

Stencil Version

"@stencil/angular-output-target": "~0.10.2", "@stencil/core": "4.23.0",

Current Behavior

The generated components.ts has the following invalid syntax:

import type { IAceDate as IAceDatePickerIAceDate } from '@ace/components';

export declare interface AceDatePicker extends Components.AceDatePicker {
  /**
   * Event will be raised when the value of the formControl has changed
   */
  valueChange: EventEmitter<CustomEvent<IAceDatePickerIAceDate.>>;
  /**
   * Event will be raised when dropdown opens or closes
   */
  openChange: EventEmitter<CustomEvent<boolean>>;
  /**
   * Event will be raised when input is focused
   */
  controlFocus: EventEmitter<CustomEvent<IAceDatePickerIAceDate.>>;
  /**
   * Event will be raised when input loses focus
   */
  controlBlur: EventEmitter<CustomEvent<IAceDatePickerIAceDate.>>;
  /**
   * Event will be raised when a validation error occurs
   */
  controlError: EventEmitter<CustomEvent<Record<string, string>>>;

...
}

Notice each EventEmitter has the following invalid syntax:

valueChange: EventEmitter<CustomEvent<IAceDatePickerIAceDate.>>;

Notice at the end of the line the following invalid syntax:

<CustomEvent<IAceDatePickerIAceDate.>>

Notice the extraneous "dot" at the end .>>

If I manually go in and delete the trailing dot, it works as expected.

Here is my stencil.config:

import { Config } from '@stencil/core';
import { sass } from '@stencil/sass';
import { reactOutputTarget } from '@stencil/react-output-target';
import { angularOutputTarget } from '@stencil/angular-output-target';

export const config: Config = {
    namespace: 'ace',
    plugins: [
        sass({
            injectGlobalPaths: ['src/include/css/variables/_index'],
            includePaths: ['../../node_modules/bootstrap', '../../node_modules/gridstack/dist']
        })
    ],
    outputTargets: [
        {
            type: 'dist-custom-elements',
            copy: [{ src: '../../../node_modules/pdfjs-dist/web/pdf_viewer.js.map', dest: 'dist/components/pdf_viewer.js.map' }],
            externalRuntime: false
        },
        {
            type: 'dist'
        },
        {
            type: 'docs-readme'
        },
        {
            type: 'docs-json', // used by storybook-addon-docs-stencil
            file: 'dist/metadata.json'
        },
        {
            type: 'www',
            serviceWorker: null, // disable service workers
            copy: [
                { src: 'pages', dest: 'pages' },
                { src: '../assets', dest: 'assets' },
                { src: '../../../node_modules/pdfjs-dist/build/pdf.worker.min.js', dest: 'assets/pdf/pdf.worker.min.js' }
            ]
        },
        angularOutputTarget({
            componentCorePackage: '@ace/components',
            outputType: 'component',
            directivesProxyFile: '../ace-components-angular/src/lib/stencil-generated/components.ts',
            directivesArrayFile: '../ace-components-angular/src/lib/stencil-generated/index.ts',
            customElementsDir: 'dist'
        }),
        reactOutputTarget({
            // Relative path to where the React components will be generated
            outDir: '../ace-components-react/src/components/stencil-generated/'
        })
    ],
    nodeResolve: {
        preferBuiltins: true,
        browser: true
    },
    testing: {
        transform: {
            '^.+\\.jsx?$': 'babel-jest'
        },
        browserExecutablePath: '/Applications/Chromium.app/Contents/MacOS/Chromium',
        testPathIgnorePatterns: ['ace-pdf-viewer', 'ace-tooltip', 'dist'], // components that load deps' tests are disabled for now
        moduleFileExtensions: ['ts', 'tsx', 'js', 'mjs', 'jsx', 'json', 'd.ts']
    },
    sourceMap: true
};

Expected Behavior

Expect the generated typescript to be valid and able to be built without hand modifying.

System Info

System: node 22.18.0
    Platform: windows (10.0.22631)
   CPU Model: Intel(R) Core(TM) Ultra 9 185H (22 cpus)
    Compiler: C:\Users\rc08281\dev\ACE-develop\node_modules\@stencil\core\compiler\stencil.js
       Build: 1733951986
     Stencil: 4.23.0
  TypeScript: 5.5.4
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

Follow the instructions found here:
https://stenciljs.com/docs/angular

Build the Component Library
Attempt to build the Angular Wrapper Component Library
Notice the syntax error in the generated components.ts file

Code Reproduction URL

n/a

Additional Information

The reactOutputTarget is working perfectly. See the included stencil.config

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reproductiona code reproduction is needed from the issue author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions