@@ -4,6 +4,8 @@ import objectSwapKeysAndValues from './custom/objectSwapKeysAndValues'
4
4
import changeStringReplaceToRegex from './custom/changeStringReplaceToRegex'
5
5
import splitDeclarationAndInitialization from './custom/splitDeclarationAndInitialization'
6
6
import addMissingProperties from './extended/addMissingProperties'
7
+ import { ApplyExtendedCodeActionResult , IpcExtendedCodeAction } from '../ipcTypes'
8
+ import { Except } from 'type-fest'
7
9
8
10
const codeActions : CodeAction [ ] = [ objectSwapKeysAndValues , changeStringReplaceToRegex , splitDeclarationAndInitialization ]
9
11
const extendedCodeActions : ExtendedCodeAction [ ] = [ addMissingProperties ]
@@ -27,11 +29,6 @@ export type ApplyCodeAction = (
27
29
languageServiceHost : ts . LanguageServiceHost ,
28
30
) => ts . RefactorEditInfo | SimplifiedRefactorInfo [ ] | true | undefined
29
31
30
- export type ApplyExtendedCodeActionResult = {
31
- edits : ts . TextChange [ ]
32
- snippetEdits : ts . TextChange [ ]
33
- }
34
-
35
32
export type CodeAction = {
36
33
name : string
37
34
id : string
@@ -60,6 +57,11 @@ export type ExtendedCodeAction = {
60
57
codes ?: number [ ]
61
58
}
62
59
60
+ type Satisfies < T , U extends T > = any
61
+
62
+ // ensure props are in sync
63
+ type CheckCodeAction = Satisfies < Except < ExtendedCodeAction , 'tryToApply' > , IpcExtendedCodeAction >
64
+
63
65
export const getExtendedCodeActions = < T extends string | undefined > (
64
66
sourceFile : ts . SourceFile ,
65
67
positionOrRange : ts . TextRange | number ,
0 commit comments