Closed
Description
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:
- It imples that there is an interface definition: interface Product[] {...};
- The notation doesn't accurately reflect the element type of the engineers array, or what the [] applies to.
- 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.