question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property '$content' does not exist on type 'Context'

See original GitHub issue

My tsconfig.json.

"compilerOptions": {
..
  "types": ["@nuxt/types",  "@nuxt/content", "@types/node"]
} 

The problem

image

Any way to resolve this?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
han-tyumicommented, Mar 16, 2021

@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.

image $axios

image image $content

Edit 2: For now I’ve made my own type definition file for just extending the Context for the time being. image Could not see any obvious errors with the default types being shipped. Not sure why this works whereas those do not.

1reaction
Linus-Boehmcommented, Apr 20, 2021

I’ve spotted this happening if multiple versions of @nuxt/types are installed - see this issue for example.

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 running yarn install https://github.com/nuxt/content/blob/939caf36c547a6b4af6e303c52ed5989a5dea2f0/packages/content/package.json#L17 Maybe its worth thinking about to make this just a peerDependency

Adding this to my package.json solved it for me:

"resolutions": {
    "**/@nuxt/types": "^2.15.4"
  }
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found