[Typescript 5.3] returnWhatIPassIn
const returnWhatIPassIn = <const T extends any[]>(t: T) => {
return t;
};
// result is any[] in TS 5.2, but ['a', 'b', 'c'] in 5.3
const result = returnWhatIPassIn(["a", "b", "c"]); // type as ["a", "b", "c"]
const returnWhatIPassIn = <const T extends any[]>(t: T) => {
return t;
};
// result is any[] in TS 5.2, but ['a', 'b', 'c'] in 5.3
const result = returnWhatIPassIn(["a", "b", "c"]); // type as ["a", "b", "c"]