@@ -4,6 +4,8 @@ import objectSwapKeysAndValues from './custom/objectSwapKeysAndValues'
44import changeStringReplaceToRegex from './custom/changeStringReplaceToRegex'
55import splitDeclarationAndInitialization from './custom/splitDeclarationAndInitialization'
66import addMissingProperties from './extended/addMissingProperties'
7+ import { ApplyExtendedCodeActionResult , IpcExtendedCodeAction } from '../ipcTypes'
8+ import { Except } from 'type-fest'
79
810const codeActions : CodeAction [ ] = [ objectSwapKeysAndValues , changeStringReplaceToRegex , splitDeclarationAndInitialization ]
911const extendedCodeActions : ExtendedCodeAction [ ] = [ addMissingProperties ]
@@ -27,11 +29,6 @@ export type ApplyCodeAction = (
2729 languageServiceHost : ts . LanguageServiceHost ,
2830) => ts . RefactorEditInfo | SimplifiedRefactorInfo [ ] | true | undefined
2931
30- export type ApplyExtendedCodeActionResult = {
31- edits : ts . TextChange [ ]
32- snippetEdits : ts . TextChange [ ]
33- }
34-
3532export type CodeAction = {
3633 name : string
3734 id : string
@@ -60,6 +57,11 @@ export type ExtendedCodeAction = {
6057 codes ?: number [ ]
6158}
6259
60+ type Satisfies < T , U extends T > = any
61+
62+ // ensure props are in sync
63+ type CheckCodeAction = Satisfies < Except < ExtendedCodeAction , 'tryToApply' > , IpcExtendedCodeAction >
64+
6365export const getExtendedCodeActions = < T extends string | undefined > (
6466 sourceFile : ts . SourceFile ,
6567 positionOrRange : ts . TextRange | number ,
0 commit comments