Next.js Discord

Discord Forum

Visual studio code extensions

Answered
Noronha posted this in #help-forum
Open in Discord
In visual studio code I have this function for example:
export async function list(
  page: number,
  query?: string,
  sort?: Sort,
): Promise<FormResponse<PaginatedResponse<FuelType>>> {


And when I try to call it like:
 const fuels = await list();


When i press control + space bar it doesnt show me the params. Why?


Using next14, typescript, ESLint, Prettier extention, Tailwind CSS IntelliSense.
Oh, any other critical extension I'm missing? 🙂
Answered by Ray
I think it should show if you turn it to object
export async function list({
  page: number,
  query?: string,
  sort?: Sort,
}):
View full answer

6 Replies

Answer
Is that a good practice? If it is I'll change. Otherwise I need stronger arguments for changing the param list to an object. I think its fishy changing the structure just to get the IDE working properly. Is what I'm saying making any sense?
so from now on all of my functions (or most of them) should receive one typed object as param and extract the values from it?
It's interesting because this bypasses the "order" you need to pass params around.
Plus, you're right, autocomplete works