Skip to content

Commit

Permalink
fix(type-id-datasource): toId throwing error for zero
Browse files Browse the repository at this point in the history
TypeIdDataSource.toId was failing for zero IDs
This commit changes the implementation to accept zero value
  • Loading branch information
felipebergamin committed Oct 30, 2023
1 parent f96030d commit a20d164
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/utils/TypeIDDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default class TypeIDDataSource {

public toId = (typename: string, realId: string | number): string => {
const typeId = this.typeIds[typename];
if (!typeId) throw new Error('Invalid typename');
if (typeId === null || typeId === undefined)
throw new Error('Invalid typename');
return TypeIDDataSource.base64encode(
`${typeId}${TypeIDDataSource.delimiter}${realId}`,
);
Expand Down

0 comments on commit a20d164

Please sign in to comment.