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.

[BUG] Property startAt does not exist on Scan.

See original GitHub issue

Summary:

The property startAt, which according to documentation should exist on startAt but it is giving me an error that it does not exist. We were migrating from dynamoose v1 to v2. However, this is not happening on dynamoose v2.7.3 but on the latest release v2.8.0.

Code sample:

Schema

export const model = model<Model & Document>(
  env('TABLE_NAME'),
  new Schema(
    {
      customerId: {
        type: String,
        hashKey: true,
      },
      productId: {
        type: String,
        rangeKey: true,
      },
    },
    { timestamps: true }
  )
);

Model

export type Model = {
  readonly customerId: string;
  readonly productId: string;
  readonly createdAt: Date;
  readonly updatedAt: Date;
};

General

export const getAllItems = async (): Promise<
  readonly Model[]
> => {
  const dataFetch = async (
     _lastKey?: Key
  ): Promise<readonly Model[]> => {
    const response =
    // _lastKey === undefined
      await model.scan().exec()
    const moreDocs = model.scan().startAt(response.lastKey)

Current output and behavior (including stack trace):

When we run our tests it says

Property 'startAt' does not exist on type 'Scan<CustomerCartItem & Document>'.

    73     const moreDocs = customerCart.scan().startAt(response.lastKey)

Expected output and behavior:

Should clear all the tests.

Environment:

Operating System: MacOS Operating System Version: 11.5.2 Node.js version (node -v): 12.21.0 NPM version: (npm -v): 6.14.11 Dynamoose version: 2.8.0

Other:

  • [ x ] I have read through the Dynamoose documentation before posting this issue
  • [ x ] I have searched through the GitHub issues (including closed issues) and pull requests to ensure this issue has not already been raised before
  • [ x ] I have searched the internet and Stack Overflow to ensure this issue hasn’t been raised or answered before
  • [ x ] I have tested the code provided and am confident it doesn’t work as intended
  • [ x ] I have filled out all fields above
  • [ x ] I am running the latest version of Dynamoose

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nirwanrajnpcommented, Aug 26, 2021

Thank you so much for making that clear @fishcharlie

0reactions
fishcharliecommented, Aug 26, 2021

@nirwanrajnp I have improved the documentation in the PR #1256. It will be deployed to dynamoosejs.com with the next release. Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

rxjs-run with TypeScript: property 'scan' does not exist on type ...
Here is a test case. Most of the code is generated by create-cycle-app. I'm not sure what to make of this. It seems...
Read more >
Why am I getting error TS2339: Property 'scan' does not exist ...
Supposedly it should have been fixed when I installed rxjs-compat , but it wasn't. Not sure why. But using pipes is now the...
Read more >
Scan - Dynamoose
Dynamoose provides the ability to scan a model by using the Model.scan function. This function acts as a builder to construct your scan...
Read more >
Breaking Changes in Version 7 - RxJS
To workaround this issue there are two things you can do: 1. Rewrite your operators as outlined in the documentation, such that they...
Read more >
startWith - Learn RxJS
Emit given value first. ... A BehaviorSubject can also start with an initial value!
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