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.

Discrepancy in docs vs typescript types for locks

See original GitHub issue

What are you doing?

I am attempting to lock a table when I perform a find query. The documentation seems to have a discrepancy in how these locks can be created, however the typescript types do not sync up

The following will produce a type error:

await MigrationLock.findAll({
  where: { isLocked: false },
  transaction,
  lock: true,
});

See below for all of the typescript warnings that also seem to be valid code as stated in the docs here and here

Screen Shot 2019-07-10 at 1 02 16 PM Screen Shot 2019-07-10 at 1 02 37 PM Screen Shot 2019-07-10 at 1 02 41 PM

To Reproduce Steps to reproduce the behavior:

  1. Define model MigrationLock using typescript
  2. Try to provide lock: true in findAll
  3. See typescript error

What do you expect to happen?

I want to be able to have a type-safe find lock on a table

What is actually happening?

Typescript keeps yelling at me

Environment

Dialect:

  • mysql
  • postgres
  • sqlite
  • mssql
  • any

Dialect library version: 10.4 Database version: 10.4 Sequelize version: 5.9.4 Node Version: v10.15.0 OS: OSX Mojave 10.14.5

If TypeScript related: TypeScript version: XXX Tested with latest release:

  • No
  • Yes, specify that version: 3.5.2

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
aecorredorcommented, Oct 28, 2019

@papb PR for this issue is here: https://github.com/sequelize/sequelize/pull/11620. Let me know if everything looks good or if I need to do something else. It’s my first time making a PR for this repo, so I might have missed something.

1reaction
papbcommented, Oct 28, 2019

@aecorredor Ah, ok! Indeed looks like a bug. Thank you very much. I will fix the issue label

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSConfig Reference - Docs on every TSConfig option
In some cases where no type annotations are present, TypeScript will fall back to ... This will allow editors such as VS Code...
Read more >
Typescript: Difference between => and : in interface function ...
There's no real difference here, you can use which one you feel more comfortable with. These may be effectively very similar, but they...
Read more >
A Proposal For Type Syntax in JavaScript - TypeScript
Today we're excited to announce our support and collaboration on a new Stage 0 proposal to bring optional and erasable type syntax to ......
Read more >
typescript-cheatsheet - GitHub Pages
A set of TypeScript related notes used for quick reference. The cheatsheet contains references to types, classes, decorators, and many other TypeScript ......
Read more >
Top 50 TypeScript Interview Questions and Answers in 2023
TypeScript adds type support to JavaScript. ... wide range of IDEs that have excellent support for TypeScript, like Visual Studio & VS code, ......
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