-
Notifications
You must be signed in to change notification settings - Fork 23
Enforce action params do not allow more parameters than in the specified type #1095
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
Conversation
@@ -83,7 +83,7 @@ export async function generatePackage( | |||
beta: options.beta, | |||
}); | |||
|
|||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this intentional?
packages/api/src/OsdkBase.ts
Outdated
@@ -35,6 +35,18 @@ export type OsdkBase< | |||
readonly $objectSpecifier: ObjectSpecifier<Q>; | |||
}; | |||
|
|||
export type OsdkWithPrimaryKey< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe should be OsdkBaseWithPrimaryKey
return o && typeof o === "object" && typeof o.$apiName === "string" | ||
export function isActionOrQueryObjectParameter( | ||
o: any, | ||
): o is { $primaryKey: any } { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming you intentionally didn't use OsdkBaseWithPrimaryKey
here because you didn't want to add it to our contract yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, i don't want to export this from API yet if ever
const objectArray = await client(OsdkTestObject).fetchPage(); | ||
|
||
// Testing Object action with OSDK instance | ||
await client($Actions.editOsdkTestObject).applyAction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add type tests in actions.test.ts to make sure our actions accept osdkInstance+primaryKey+osdkBase+osdkBaseWithPrimaryKey?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will add them there as well. I should have commented this but I added the tests in our e2e so they'll be run during our backcompat tests as well. I think for the future its probably best we have coverage in both places as well
f13e8af
to
2b2f39f
Compare
Fixes #104


Before:
Generic expands type def only when fully complete:
After:
