Using `number | null` ends up in an error
PeterMK85 opened this issue ยท 2 comments
PeterMK85 commented
Hey ๐
I think I faced with a possible issue, the source type generated by the swagger-typescript-api
package.
Steps to reproduce
- Have a type with a nullable field:
Failing Example:export interface ExampleKey { /** @format int64 */ activeUntil: number | null; allowExportDashboard: boolean; email: string; firstName?: string; isValid: boolean; lastName?: string; }
If the ... | null
removed, the mock will be created as expected.
Errors:
Online interface will throw the following error:
m[a] is not a function
CLI will throw the following error:
Unsupported Primitive type 173
Is it something expected or it is a bug?
Anthony-YY commented
encounter such issues too. one workaround is to replace all | null
with empty strings in fileData.
mock({files: [filePath, fileData]})
elie222 commented
Quick fix when using the online editor:
Select | null
. Command D to select them all. Delete.