| 1133 | instance: ComponentInternalInstance, |
| 1134 | ): SetupContext { |
| 1135 | const expose: SetupContext['expose'] = exposed => { |
| 1136 | if (__DEV__) { |
| 1137 | if (instance.exposed) { |
| 1138 | warn(`expose() should be called only once per setup().`) |
| 1139 | } |
| 1140 | if (exposed != null) { |
| 1141 | let exposedType: string = typeof exposed |
| 1142 | if (exposedType === 'object') { |
| 1143 | if (isArray(exposed)) { |
| 1144 | exposedType = 'array' |
| 1145 | } else if (isRef(exposed)) { |
| 1146 | exposedType = 'ref' |
| 1147 | } |
| 1148 | } |
| 1149 | if (exposedType !== 'object') { |
| 1150 | warn( |
| 1151 | `expose() should be passed a plain object, received ${exposedType}.`, |
| 1152 | ) |
| 1153 | } |
| 1154 | } |
| 1155 | } |
| 1156 | instance.exposed = exposed || {} |
| 1157 | } |
| 1158 | |
| 1159 | if (__DEV__) { |
| 1160 | // We use getters in dev in case libs like test-utils overwrite instance |