Need help with json in typescript

I have a json file
{
"1a": {
"mainHint": "hello",
"commentHint": "yay"
},
"2a": {
"mainHint": "hello2",
"commentHint": "yay2"
},
"3a": {
"mainHint": "hello3",
"commentHint": "yay3"
},
"4a": {
"mainHint": "hello4",
"commentHint": "yay4"
}
}
{
"1a": {
"mainHint": "hello",
"commentHint": "yay"
},
"2a": {
"mainHint": "hello2",
"commentHint": "yay2"
},
"3a": {
"mainHint": "hello3",
"commentHint": "yay3"
},
"4a": {
"mainHint": "hello4",
"commentHint": "yay4"
}
}
Now I want to access it in typescript as follows
"use client";
import levels from '../leveldat.json'

const Level=({level, branch}: {level:string, branch:string})=>{

console.log(levels[`${level}${branch}`])
return <p>{}</p>
}

export default Level
"use client";
import levels from '../leveldat.json'

const Level=({level, branch}: {level:string, branch:string})=>{

console.log(levels[`${level}${branch}`])
return <p>{}</p>
}

export default Level
But it shows Element implicitly has an 'any' type because expression of type 'string How can I fix this
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server