toSorted is throwing error in Runtime
Answered
Ghost ant posted this in #help-forum
Ghost antOP
I chose to use
Nextjs v: 14.0.1
toSorted for the first time, but I ran into an error, is it too early to use it?Nextjs v: 14.0.1
`ts
// tsconfig
{
"compilerOptions": {
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
}12 Replies
Ghost antOP
I could feel it!
@Ray `toSorted` is supported in node v20+
Giant panda
That's wrong. It's supported in v20+
Ghost antOP
yes, but I am still using v 18.x
Giant panda
I was correcting Ray because he accidentally phrased it as if it's not available at all in Node.
Offtopic: Anyways, you should consider upgrading to v20 as this is the new LTS.
Ghost antOP
it is still in beta, I prefer to wait till becomes stable
Giant panda
It's LTS ever since October
@Giant panda It's LTS ever since October
Beta as a runtime version on vercel
@Ray `toSorted` is supported in node v20+
I marked this as the sol but could you edit to clarify that toSorted is only available from node 20?