From cdfb0deb14b4ac5d10629a6f960e0300ffcba76a Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 26 Apr 2022 09:22:15 -0400 Subject: [PATCH] Fix type error after rebase Signed-off-by: Sebastian Malton --- src/renderer/utils/jsonPath.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/utils/jsonPath.ts b/src/renderer/utils/jsonPath.ts index 3aedbd0919..a4ea5db3ae 100644 --- a/src/renderer/utils/jsonPath.ts +++ b/src/renderer/utils/jsonPath.ts @@ -4,12 +4,13 @@ */ import { JSONPath } from "@astronautlabs/jsonpath"; +import { TypedRegEx } from "typed-regex"; const slashDashSearch = /[\\-]/g; const pathByBareDots = /(?<=\w)\./; const textBeforeFirstSquare = /^.*(?=\[)/g; const backSlash = /\\/g; -const kubectlOptionPrefix = /^\$?\.?(?.*)/; +const kubectlOptionPrefix = TypedRegEx("^\\$?\\.?(?.*)"); const sliceVersion = /\[]/g; const tripleDotName = /\.\.\.(?.)/g; const trailingDotDot = /\.\.$/; @@ -28,10 +29,10 @@ const trailingDotDot = /\.\.$/; * - Allow `...foo` as well as `..foo` */ export function convertKubectlJsonPathToNodeJsonPath(jsonPath: string) { - const startMatch = jsonPath.match(kubectlOptionPrefix); + const startMatch = kubectlOptionPrefix.match(jsonPath); let start = "$"; - if (!startMatch) { + if (!startMatch.groups) { return start; }