Skip to content

fix: Ensure types allow optional function arguments to be omitted#64

Open
zhibek wants to merge 1 commit intonordigen:masterfrom
zhibek:patch-1
Open

fix: Ensure types allow optional function arguments to be omitted#64
zhibek wants to merge 1 commit intonordigen:masterfrom
zhibek:patch-1

Conversation

@zhibek
Copy link

@zhibek zhibek commented Nov 6, 2024

Related Issue

The current type definitions do not distinguish between optional and required function arguments.

Therefore, the standard NordigenClient instantiation in Typescript results in a type error:

const client = new NordigenClient({
  secretId: process.env.SECRET_ID,
  secretKey: process.env.SECRET_KEY,
});
$ npm exec tsc
src/example.ts:1:35 - error TS2345: Argument of type '{ secretId: string; secretKey: string; }' is not assignable to parameter of type '{ secretId: string; secretKey: string; baseUrl: string; }'.
  Property 'baseUrl' is missing in type '{ secretId: string; secretKey: string; }' but required in type '{ secretId: string; secretKey: string; baseUrl: string; }'.

Proposed Changes

  • Update type definitions for NordigenClient constructor() and initSession() to recognise optional arguments.

Additional Info

n/a

Copy link

@Betree Betree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to merge this one!

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

Successfully merging this pull request may close these issues.

2 participants