Skip to content

Commit f9eca60

Browse files
lane711cp-bwgclaude
committed
fix: resolve TypeScript errors in rich text editor plugins from PR #757
- Fix import paths for PluginBuilder (../../sdk/ not ../../../sdk/) - Add non-null assertions for regex match groups in shortcode-resolver - Add non-null assertions for array indexing in date formatting Co-Authored-By: brad <brad@comparepower.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3a01fb7 commit f9eca60

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

packages/core/src/plugins/core-plugins/global-variables-plugin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
import { Hono } from 'hono'
16-
import { PluginBuilder } from '../../../sdk/plugin-builder'
16+
import { PluginBuilder } from '../../sdk/plugin-builder'
1717
import { wrapAdminPage } from '../_shared/admin-template'
1818
import {
1919
resolveVariablesInObject,

packages/core/src/plugins/core-plugins/shortcodes-plugin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { Hono } from 'hono'
18-
import { PluginBuilder } from '../../../sdk/plugin-builder'
18+
import { PluginBuilder } from '../../sdk/plugin-builder'
1919
import { wrapAdminPage } from '../_shared/admin-template'
2020
import {
2121
resolveShortcodesInObject,

packages/core/src/plugins/core-plugins/shortcodes-plugin/shortcode-resolver.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function parseShortcodeParams(paramStr: string): Record<string, string> {
5353
const regex = /(\w+)="([^"]*)"/g
5454
let match
5555
while ((match = regex.exec(paramStr)) !== null) {
56-
params[match[1]] = match[2]
56+
params[match[1]!] = match[2]!
5757
}
5858
return params
5959
}
@@ -78,8 +78,8 @@ export async function resolveShortcodes(
7878

7979
let m
8080
while ((m = SHORTCODE_PATTERN.exec(text)) !== null) {
81-
const name = m[1]
82-
const paramStr = m[2]
81+
const name = m[1]!
82+
const paramStr = m[2] || ''
8383
const params = parseShortcodeParams(paramStr)
8484
const handler = handlerRegistry.get(name)
8585

@@ -146,8 +146,8 @@ registerShortcodeHandler('current_date', (params) => {
146146
return format
147147
.replace('YYYY', String(now.getFullYear()))
148148
.replace('YY', String(now.getFullYear()).slice(-2))
149-
.replace('MMMM', months[now.getMonth()])
150-
.replace('MMM', monthsShort[now.getMonth()])
149+
.replace('MMMM', months[now.getMonth()]!)
150+
.replace('MMM', monthsShort[now.getMonth()]!)
151151
.replace('MM', String(now.getMonth() + 1).padStart(2, '0'))
152152
.replace('DD', String(now.getDate()).padStart(2, '0'))
153153
.replace('D', String(now.getDate()))

0 commit comments

Comments
 (0)