Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model.create() does not have the option to set only overwrite #87

Closed
MickL opened this issue May 20, 2020 · 6 comments
Closed

Model.create() does not have the option to set only overwrite #87

MickL opened this issue May 20, 2020 · 6 comments

Comments

@MickL
Copy link
Contributor

MickL commented May 20, 2020

catModel.create(cat, { overwrite: true } ); -> Complains that it requires return

@hardyscc
Copy link
Owner

@MickL Please add return: "document" like following

catModel.create(cat, { overwrite: true, return: "document" } );

@MickL
Copy link
Contributor Author

MickL commented May 23, 2020

Why? That is not a required value by Dynamoose, just in your interfaces 😕

Same problem for:

Model.get(
            {id},
            {
                attributes: ['something'],
            },
);

Also wants to have return:

Property 'return' is missing in type '{ attributes: string[]; }' but required in type 'ModelGetSettings'.

@hardyscc
Copy link
Owner

hardyscc commented May 23, 2020

@MickL please check this out from dynamoose

https://github.com/dynamoose/dynamoose/blob/27326613aa391f0223ef05d2e95c21e33d630a27/lib/Model/index.ts#L828

which is exactly the same as here :

  get( key: Key, settings: ModelGetSettings & { return: 'document' }): Promise<Data>;

The reason is that it is required by the Typescript type inference to correctly choose the right interface, so you will face the same problem if you use the type from dynamoose too.

@MickL
Copy link
Contributor Author

MickL commented May 23, 2020

Hm then maybe that interface is wrong? I am not using return: 'document' with @ts-ignore and it works as expected. I dont think it is or should be required.

@hardyscc
Copy link
Owner

hardyscc commented May 23, 2020

@MickL yes it shouldn't be required, however it may due to some technical difficulty, you may ask @fishcharlie about this :)

@MickL
Copy link
Contributor Author

MickL commented May 23, 2020

I opened an issue: dynamoose/dynamoose#912

@hardyscc hardyscc added wait for others Wait for others and removed wait for others Wait for others labels Jun 6, 2020
@hardyscc hardyscc closed this as completed Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants