Skip to content

Commit

Permalink
fix: type errors caused by upstream updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Sep 28, 2024
1 parent 9234695 commit 5975fb7
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 319 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/vscode": "^1.93.0",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-dts": "^3.9.1"
"vite-plugin-dts": "^4.2.1"
},
"publishConfig": {
"exports": {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/composables/useTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export function useTerminal(...args: any[]): UseTerminalReturn {
get exitStatus() {
return terminal.exitStatus
},
get shellIntegration() {
return terminal.shellIntegration
},
sendText: terminal.sendText.bind(terminal),
show: terminal.show.bind(terminal),
hide: terminal.hide.bind(terminal),
Expand Down
86 changes: 43 additions & 43 deletions packages/core/src/utils/defineConfigObject.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
import type { UnwrapNestedRefs } from '@reactive-vscode/reactivity'
import { reactive } from '@reactive-vscode/reactivity'
import type { ConfigurationScope, ConfigurationTarget } from 'vscode'
import type { ConfigTypeOptions, ParseConfigTypeOptions } from './defineConfigs'
import { defineConfigs } from './defineConfigs'
import type { Nullable } from './types'

export type ConfigObject<C extends object> = UnwrapNestedRefs<C> & {
/**
* Write the configuration value to the workspace.
*
* @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
*/
$update: (key: keyof C, value: C[keyof C], configurationTarget?: Nullable<ConfigurationTarget>, overrideInLanguage?: boolean) => Promise<void>

/**
* Set the value without updating the workspace.
*/
$set: (key: keyof C, value: C[keyof C]) => void
}

/**
* Define configurations of an extension. See `vscode::workspace.getConfiguration`.
*
* You can use this function with [vscode-ext-gen](https://github.com/antfu/vscode-ext-gen).
*
* @category lifecycle
*/
export function defineConfigObject<const C extends ConfigTypeOptions>(section: Nullable<string>, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<ParseConfigTypeOptions<C>>
export function defineConfigObject<C extends object>(section: Nullable<string>, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<C>
export function defineConfigObject(section: Nullable<string>, configs: Record<string, unknown>, scope?: Nullable<ConfigurationScope>) {
const configRefs = defineConfigs(section, configs, scope)

return reactive({
...configRefs,
$update(key, value, configurationTarget, overrideInLanguage) {
return configRefs[key].update(value, configurationTarget, overrideInLanguage)
},
$set(key, value) {
return configRefs[key].set(value)
},
}) satisfies ConfigObject<typeof configs>
}
import type { UnwrapNestedRefs } from '@reactive-vscode/reactivity'
import { reactive } from '@reactive-vscode/reactivity'
import type { ConfigurationScope, ConfigurationTarget } from 'vscode'
import type { ConfigTypeOptions, ParseConfigTypeOptions } from './defineConfigs'
import { defineConfigs } from './defineConfigs'
import type { Nullable } from './types'

export type ConfigObject<C extends object> = UnwrapNestedRefs<C> & {
/**
* Write the configuration value to the workspace.
*
* @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
*/
$update: (key: keyof C, value: C[keyof C], configurationTarget?: Nullable<ConfigurationTarget>, overrideInLanguage?: boolean) => Promise<void>

/**
* Set the value without updating the workspace.
*/
$set: (key: keyof C, value: C[keyof C]) => void
}

/**
* Define configurations of an extension. See `vscode::workspace.getConfiguration`.
*
* You can use this function with [vscode-ext-gen](https://github.com/antfu/vscode-ext-gen).
*
* @category lifecycle
*/
export function defineConfigObject<const C extends ConfigTypeOptions>(section: Nullable<string>, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<ParseConfigTypeOptions<C>>
export function defineConfigObject<C extends object>(section: Nullable<string>, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<C>
export function defineConfigObject(section: Nullable<string>, configs: Record<string, unknown>, scope?: Nullable<ConfigurationScope>) {
const configRefs = defineConfigs(section, configs, scope)

return reactive({
...configRefs,
$update(key: string, value: any, configurationTarget: any, overrideInLanguage: any) {
return configRefs[key].update(value, configurationTarget, overrideInLanguage)
},
$set(key: string, value: any) {
return configRefs[key].set(value)
},
}) satisfies ConfigObject<typeof configs>
}
2 changes: 1 addition & 1 deletion packages/reactivity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@vue/shared": "3.4.27",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-dts": "^3.9.1"
"vite-plugin-dts": "^4.2.1"
},
"publishConfig": {
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vueuse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@vueuse/core": "^11.1.0",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-dts": "^3.9.1"
"vite-plugin-dts": "^4.2.1"
},
"publishConfig": {
"exports": {
Expand Down
Loading

0 comments on commit 5975fb7

Please sign in to comment.