Skip to content

Commit a177092

Browse files
committedSep 23, 2024··
fix(runtime-core): make useId() always return a string
1 parent 5e88985 commit a177092

File tree

1 file changed

+2
-1
lines changed
  • packages/runtime-core/src/helpers

1 file changed

+2
-1
lines changed
 

‎packages/runtime-core/src/helpers/useId.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from '../component'
55
import { warn } from '../warning'
66

7-
export function useId(): string | undefined {
7+
export function useId(): string {
88
const i = getCurrentInstance()
99
if (i) {
1010
return (i.appContext.config.idPrefix || 'v') + '-' + i.ids[0] + i.ids[1]++
@@ -14,6 +14,7 @@ export function useId(): string | undefined {
1414
`instance to be associated with.`,
1515
)
1616
}
17+
return ''
1718
}
1819

1920
/**

0 commit comments

Comments
 (0)
Please sign in to comment.