Files
outline/server/presenters/policy.ts
Tom Moor 15b1069bcc chore: Move to Typescript (#2783)
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously.

closes #1282
2021-11-29 06:40:55 -08:00

21 lines
574 B
TypeScript

import { User } from "@server/models";
type Policy = {
id: string;
abilities: Record<string, boolean>;
};
export default function present(
// @ts-expect-error ts-migrate(2749) FIXME: 'User' refers to a value, but is being used as a t... Remove this comment to see the full error message
user: User,
objects: Record<string, any>[]
): Policy[] {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { serialize } = require("../policies");
return objects.map((object) => ({
id: object.id,
abilities: serialize(user, object),
}));
}