Skip to content

Commit 1bab53e

Browse files
committed
chore: remove deprecated defineEmit & useContext APIs
1 parent d4c67dd commit 1bab53e

File tree

3 files changed

+0
-47
lines changed

3 files changed

+0
-47
lines changed

packages/runtime-core/src/apiSetupHelpers.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ export function defineEmits() {
109109
return null as any
110110
}
111111

112-
/**
113-
* @deprecated use `defineEmits` instead.
114-
*/
115-
export const defineEmit = defineEmits
116-
117112
/**
118113
* Vue `<script setup>` compiler macro for declaring a component's exposed
119114
* instance properties when it is accessed by a parent component via template
@@ -178,19 +173,6 @@ export function withDefaults<Props, Defaults extends InferDefaults<Props>>(
178173
return null as any
179174
}
180175

181-
/**
182-
* @deprecated use `useSlots` and `useAttrs` instead.
183-
*/
184-
export function useContext(): SetupContext {
185-
if (__DEV__) {
186-
warn(
187-
`\`useContext()\` has been deprecated and will be removed in the ` +
188-
`next minor release. Use \`useSlots()\` and \`useAttrs()\` instead.`
189-
)
190-
}
191-
return getContext()
192-
}
193-
194176
export function useSlots(): SetupContext['slots'] {
195177
return getContext().slots
196178
}

packages/runtime-core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ export {
6565
// internal
6666
mergeDefaults,
6767
withAsyncContext,
68-
// deprecated
69-
defineEmit,
70-
useContext,
7168
useAttrs,
7269
useSlots
7370
} from './apiSetupHelpers'

test-dts/setupHelpers.test-d.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {
22
expectType,
33
defineProps,
4-
defineEmit,
54
defineEmits,
6-
useContext,
75
useAttrs,
86
useSlots,
97
withDefaults,
@@ -113,30 +111,6 @@ describe('defineEmits w/ runtime declaration', () => {
113111
emit2('baz')
114112
})
115113

116-
describe('deprecated defineEmit', () => {
117-
const emit = defineEmit({
118-
foo: () => {},
119-
bar: null
120-
})
121-
emit('foo')
122-
emit('bar', 123)
123-
// @ts-expect-error
124-
emit('baz')
125-
})
126-
127-
describe('useContext', () => {
128-
const { attrs, emit, slots } = useContext()
129-
expectType<Record<string, unknown>>(attrs)
130-
expectType<(...args: any[]) => void>(emit)
131-
expectType<Slots>(slots)
132-
133-
// @ts-expect-error
134-
props.foo
135-
// should be able to emit anything
136-
emit('foo')
137-
emit('bar')
138-
})
139-
140114
describe('useAttrs', () => {
141115
const attrs = useAttrs()
142116
expectType<Record<string, unknown>>(attrs)

0 commit comments

Comments
 (0)