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.

Typescript doesn't recognize properties on `this` in standalone ts file

See original GitHub issue

Reproduction

We’re working on a stand-alone lib of “common” pinia stores that we can re-use across different front end projects within our team. Kinda like a library of pinias. It’s working, but we seem to be losing type detection on this when we setup pinia in a stand alone project. I’ve attached an example of how we have things setup.

Steps to reproduce the behavior

  1. Open shared-stores example project attached
  2. go to cool-store.ts
  3. See error

Expected behavior

properties added to state would be recognized when accessing this in actions or getters

Actual behavior

these properties are not recognized

Additional information

Screen Shot 2021-04-26 at 3 59 36 PM

shared-stores.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
posvacommented, Apr 26, 2021

No worries, remember there is a Discord chat to ask quick questions! You can also use <kbd>cmd + shift + p</kbd> and search for restart ts

2reactions
shayneocommented, Apr 27, 2021

Thanks for the quick response @posva and the amazing work on this lib!

We’ll jump in the discord chat first if we hit other snags. @kruebling and I are working on a mono-repo setup for multiple vue 3 apps, which is also our first big jump into typescript. Maybe we’ll write a blog if it works out 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript type error standalone script. · Issue #2175 - GitHub
I decided to run standalone Typescript script via ts-node, problem is simple: I use property "ethers" from "hre" and it exists and works,...
Read more >
ts is missing from the TypeScript compilation. Please make ...
In my case (i'm using Angular), i just set typescript related path into tsconfig.app.json (ATTENTION: file name is not tsconfig.json ) ...
Read more >
TypeScript: JavaScript With Syntax For Types.
TypeScript is JavaScript with syntax for types. TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at ......
Read more >
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >
TypeScript configuration - Angular
When the compiler doesn't recognize something, it reports an error. Use TypeScript type definition files — d.ts files — to tell the compiler...
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