Skip to content

Commit

Permalink
remove ts-nocheck
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Mar 8, 2024
1 parent 83b2ecc commit 6ed592b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/pkg/ui_nodes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0
// @ts-nocheck
import {
UiNode,
UiNodeAnchorAttributes,
Expand Down Expand Up @@ -45,7 +44,7 @@ export const getNodeLabel = (node: UiNode): string => {
*/
export function isUiNodeAnchorAttributes(
attrs: UiNodeAttributes,
): attrs is UiNodeAnchorAttributes {
): attrs is UiNodeAnchorAttributes & { node_type: "a" } {
return attrs.node_type === "a"
}

Expand All @@ -56,7 +55,7 @@ export function isUiNodeAnchorAttributes(
*/
export function isUiNodeImageAttributes(
attrs: UiNodeAttributes,
): attrs is UiNodeImageAttributes {
): attrs is UiNodeImageAttributes & { node_type: "img" } {
return attrs.node_type === "img"
}

Expand All @@ -67,7 +66,7 @@ export function isUiNodeImageAttributes(
*/
export function isUiNodeInputAttributes(
attrs: UiNodeAttributes,
): attrs is UiNodeInputAttributes {
): attrs is UiNodeInputAttributes & { node_type: "input" } {
return attrs.node_type === "input"
}

Expand All @@ -78,7 +77,7 @@ export function isUiNodeInputAttributes(
*/
export function isUiNodeTextAttributes(
attrs: UiNodeAttributes,
): attrs is UiNodeTextAttributes {
): attrs is UiNodeTextAttributes & { node_type: "text" } {
return attrs.node_type === "text"
}

Expand All @@ -89,7 +88,7 @@ export function isUiNodeTextAttributes(
*/
export function isUiNodeScriptAttributes(
attrs: UiNodeAttributes,
): attrs is UiNodeScriptAttributes {
): attrs is UiNodeScriptAttributes & { node_type: "script" } {
return attrs.node_type === "script"
}

Expand Down Expand Up @@ -150,8 +149,10 @@ export const filterNodesByGroups = ({
withoutDefaultAttributes,
excludeAttributes,
}: FilterNodesByGroups) => {
const search = (s: Array<string> | string) =>
typeof s === "string" ? s.split(",") : s
const search = (s: Array<string> | string | undefined) => {
if (!s) return []
return typeof s === "string" ? s.split(",") : s
}

return nodes.filter(({ group, attributes: attr }) => {
// if we have not specified any group or attribute filters, return all nodes
Expand Down

0 comments on commit 6ed592b

Please sign in to comment.