Property '$content' does not exist on type 'Context'
See original GitHub issueMy tsconfig.json.
"compilerOptions": {
..
"types": ["@nuxt/types", "@nuxt/content", "@types/node"]
}
The problem
Any way to resolve this?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
React, Typescript, Hooks - Property 'state' does not exist on type
I'm still getting an error with initialState at this line const TodosContext = React.createContext<ITodosContextData>(initialState); The error ...
Read more >Property does not exist on type '{}' in TypeScript | bobbyhadz
The "Property does not exist on type '{}'" error occurs when we try to access or set a property that is not contained...
Read more >How do I add types for React's useContext? : r/typescript - Reddit
When I hover over state or dispatch, I get "Property 'state' does not exist on type 'AppState'." and "Property 'dispatch' does not exist...
Read more >How to fix property not existing on EventTarget in TypeScript
A common error that occurs when working with the DOM in TypeScript is “property 'property name' not existing on EventTarget ”. This error...
Read more >Working with React Context in TypeScript
If RadioGroupItem is used outside of RadioGroup , we'll get a type error pointing back to the component: // TypeError: Cannot read property...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe I am also having this issue, but it does not appear to happen in CodeSandbox: https://codesandbox.io/s/eloquent-rgb-0dltv?file=/pages/index.vue. It may be a VSCode issue?
Edit: It’s worth noting that I do not get this when using the similarly configured Axios module: https://axios.nuxtjs.org/setup/#typescript.
Edit 2: For now I’ve made my own type definition file for just extending the
Context
for the time being. Could not see any obvious errors with the default types being shipped. Not sure why this works whereas those do not.Thx Daniel, You are right, but I guess this came from a
devDependency
of@nuxt/content
at least the duplicated entry is still there after removing the lock file and runningyarn install
https://github.com/nuxt/content/blob/939caf36c547a6b4af6e303c52ed5989a5dea2f0/packages/content/package.json#L17 Maybe its worth thinking about to make this just apeerDependency
Adding this to my
package.json
solved it for me: