hughsk / flat

:steam_locomotive: Flatten/unflatten nested Javascript objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for typescript

tedawf opened this issue · comments

Although there is a types file merged in by PR #151

image

But npm install flat does not install the types definitions too? There is no index.d.ts in my flat module, causing this error message

Could not find a declaration file for module 'flat'. 'C:/Users/tedaw/dev/work/code/nftvue/node_modules/.pnpm/flat@5.0.2/node_modules/flat/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/flat` if it exists or add a new declaration (.d.ts) file containing `declare module 'flat';` 

Am I installing this wrongly? Im using typescript and nextjs 13

You have an older version of flat installed, only version 6.0 has the types included.

That's strange. npm i flat doesn't install the latest v6? How would I get that version then?

Not sure why, but you can always target the latest version by running npm install --save flat@latest.