Skip to content

Commit

Permalink
chore: symbols as helperNameMap index type (vuejs#6622)
Browse files Browse the repository at this point in the history
  • Loading branch information
4xii authored and chrislone committed Feb 4, 2023
1 parent 9785697 commit 8167e69
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/compiler-core/src/runtimeHelpers.ts
Expand Up @@ -42,8 +42,7 @@ export const IS_MEMO_SAME = Symbol(__DEV__ ? `isMemoSame` : ``)

// Name mapping for runtime helpers that need to be imported from 'vue' in
// generated code. Make sure these are correctly exported in the runtime!
// Using `any` here because TS doesn't allow symbols as index type.
export const helperNameMap: any = {
export const helperNameMap: Record<symbol, string> = {
[FRAGMENT]: `Fragment`,
[TELEPORT]: `Teleport`,
[SUSPENSE]: `Suspense`,
Expand Down Expand Up @@ -85,7 +84,7 @@ export const helperNameMap: any = {
[IS_MEMO_SAME]: `isMemoSame`
}

export function registerRuntimeHelpers(helpers: any) {
export function registerRuntimeHelpers(helpers: Record<symbol, string>) {
Object.getOwnPropertySymbols(helpers).forEach(s => {
helperNameMap[s] = helpers[s]
})
Expand Down

0 comments on commit 8167e69

Please sign in to comment.