ts-error-translator
ts-error-translator copied to clipboard
Translation request for 4104
Hi,
I have this
export const AUTHORIZED_AIRPORT_TYPES = ['large_airport', 'medium_airport'] as const;
export type AirportType = typeof AUTHORIZED_AIRPORT_TYPES[number];
And I'm trying to do this
async getAll(filters: AirportType[] = AUTHORIZED_AIRPORT_TYPES): Promise<Airport[]> {
return await Array.from(this.airports.entries()).filter(([_, airport]) => filters.includes(airport.type)).map(([_, airport]) => airport)
}
I get an ts4104 error on the method definition but I actually don't understand it.
Error Text
The type 'readonly ["large_airport", "medium_airport"]' is 'readonly' and cannot be assigned to the mutable type '("large_airport" | "medium_airport")[]'.
Supporting Information
Please provide other information which led to this error, and any specific questions you have about it: