Skip to content

Mangling interface bindings to indicate identifier type #61710

Closed
@mda-jobs

Description

@mda-jobs

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Regarding the following sample code:

import { Product } from "@shared/product.model";
export const engineers: Product[] = [...];

The engineers declaration uses the notation Product[], which is neither intuitive, nor logical, on the following counts:

  1. It imples that there is an interface definition: interface Product[] {...};
  2. The notation doesn't accurately reflect the element type of the engineers array, or what the [] applies to.
  3. Product[] looks like accessor syntax in which someone forgot the index.

The fix for this is to change the notation to:

export const engineers: [Product] = [...];

This correctly reflects the situation without mangling the interface binding and is closer to JS syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UnactionableThere isn't something we can do with this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions