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

chore(typedefs): added typedefs #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mat2718
Copy link

@mat2718 mat2718 commented Mar 20, 2023

added type definitions to the results for MRZ as well as consolidated all the types into a singular file and exported them from the index.ts file for ease of use with developers.

also added comments and documentation where possible and some mild lint clean up

added type definitions to the results for MRZ as well as consolidated all the types into a singular file and exported them from the index.ts file for ease of use with developers.

also added comments and documentation where possible and some mild lint clean up
}

/**
* It takes a string and returns a string
Copy link
Contributor

Choose a reason for hiding this comment

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

This description is not helpful (just describes what already is understandable from the type anotations)


/**
* It takes a string and returns a string
* @param {string} char - The character to convert.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • The params don't need type annotations in JS doc since they are available from the TS types.
  • The param description doesn't add helpful context (the function name letterToNumber already says it converts a char.

/**
* It takes a string and returns a string
* @param {string} char - The character to convert.
* @returns A function that takes a string and returns a string.
Copy link
Contributor

Choose a reason for hiding this comment

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

  • The return value does to need type annotation with JS doc since already available from TS
  • The description is not helpful

corrected: string;
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remove those (autogenerated?) comments all over the PR.

They add a lot of unnecessary noise.

* @param {string[]} lines - An array of strings, each string representing a line of the MRZ.
* @param {ParseMRZOptions} options - ParseMRZOptions
* @returns the result of the getResult function.
*/
export default function parseTD1(lines: string[], options: ParseMRZOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add types in return values to all the parsers (this one but also TD2, TD3 etc...)

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