Typescript Error at `pre` hook?
See original GitHub issueI have i am trying to implement pre
hook. The following code works fine, but it is giving me TS lint error potantially invalid reference access to a class field via this. of a nested function
.
@pre<Cat>('save', function (next) {
this.updatedAt = new Date();
next();
})
But the above code working though. It updates my updatedaAt field.
I am not sure this is related to this library or typegoose itself. But any help would be appriciated!
Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Typescript throws compilation error in Mongoose pre hook ...
I am looking at example code which is placed inside the users.ts file, inside a User model. userSchema.pre('save', async function( ...
Read more >Run a TypeScript type check in your pre-commit hook using ...
A great way to prevent TypeScript compilation errors from bringing down your CI pipelines is to introduce a type check before you commit...
Read more >Git pre-commit hook for Typescript errors - Reddit
I wanted to write a git pre-commit hook to abort a commit if there are errors. From the command line I could just...
Read more >Create a Pre-commit Git Hook to Check and Fix Your ...
In this post, we will introduce how to create a Git pre-commit hook to check JavaScript/TypeScript code using ESLint, Prettier, lint-staged, and Husky....
Read more >Pre-Commit Hooks for Pretter and ESLint in TypeScript Projects
Before allowing any commits to occur, format the code with Prettier and check for any ESLint warnings or errors.
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
@emjimadhu @AlecDusheck @kpfromer I use webstorm and this is what I use
Yeah I think something about the decorator confuses the WebStorm inspector and makes it believe that you don’t have access to
this