According to https://arethetypeswrong.github.io/?p=permitio%402.4.1 there appears to be TS issues.
While developing it also comes across as problematic. Using permit.api.roles.create is the one I came across so far, if I Go to Definition in VS Code I get:
/**
* Creates a new role.
*
* @param roleData The data for the new role.
* @returns A promise that resolves to the created role.
* @throws {@link PermitApiError} If the API returns an error HTTP status code.
* @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context.
*/
async create(roleData) {
await this.ensureAccessLevel(context_1.ApiKeyLevel.ENVIRONMENT_LEVEL_API_KEY);
await this.ensureContext(context_1.ApiContextLevel.ENVIRONMENT);
try {
return (await this.roles.createRole(Object.assign(Object.assign({}, this.config.apiContext.environmentContext), { roleCreate: roleData }))).data;
}
catch (err) {
this.handleApiError(err);
}
}
Unfortunately, that has no type information available for me to inspect roleData or the return type.
If I instead do Go to Type Definition, I get only the return type RoleRead pulled up, which doesn't take me to the type of create nor show RoleCreate. The only way to navigate there is to instead use Go to Implementations, which I've never had to do before
- Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
Ideally one could navigate to the type definition as expected.
EDIT: The tsconfig.json is targeting a much lower version than expected, so generally out of date https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping. Ideally this should be targeting ES2022 as node 16 is EOL.
I'm submitting a ...
[X] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
According to https://arethetypeswrong.github.io/?p=permitio%402.4.1 there appears to be TS issues.
While developing it also comes across as problematic. Using
permit.api.roles.createis the one I came across so far, if IGo to Definitionin VS Code I get:Unfortunately, that has no type information available for me to inspect
roleDataor the return type.If I instead do
Go to Type Definition, I get only the return typeRoleReadpulled up, which doesn't take me to the type ofcreatenor showRoleCreate. The only way to navigate there is to instead useGo to Implementations, which I've never had to do beforeIdeally one could navigate to the type definition as expected.
EDIT: The tsconfig.json is targeting a much lower version than expected, so generally out of date https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping. Ideally this should be targeting ES2022 as node 16 is EOL.