Skip to content

Commit 598895b

Browse files
committed
chore: fix tsconfig and add types for react and codemirror/autocompletion
1 parent ea27161 commit 598895b

File tree

4 files changed

+58
-4
lines changed

4 files changed

+58
-4
lines changed

lib/utils/autocompletion.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@ import { EditorView } from '@codemirror/view';
22
import { autocompletion, startCompletion } from '@codemirror/autocomplete';
33
import { syntaxTree } from '@codemirror/language';
44

5+
/**
6+
* @typedef {import('../types').Variables} Variables
7+
* @typedef {import('@codemirror/autocomplete').CompletionContext} CompletionContext
8+
* @typedef {import('@codemirror/autocomplete').CompletionResult} CompletionResult
9+
*/
10+
11+
/**
12+
* @param {Variables} variables
13+
*/
514
export function getAutocompletionExtensions(variables) {
615
return [
716
autoCompletionExtension(variables),
817
startCompletionExtension(),
918
];
1019
}
1120

21+
/**
22+
* @param {Variables} variables
23+
*/
1224
function autoCompletionExtension(variables) {
1325
return autocompletion({
1426
override: [
@@ -44,6 +56,12 @@ function startCompletionExtension() {
4456
});
4557
}
4658

59+
/**
60+
* @param {CompletionContext} context
61+
* @param {Array} variables
62+
*
63+
* @returns {CompletionResult | null}
64+
*/
4765
function autocomplete(context, variables) {
4866
const { state, pos } = context;
4967

package-lock.json

Lines changed: 37 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
"@eslint/js": "^9.31.0",
4444
"@testing-library/react": "^16.3.0",
4545
"@testing-library/user-event": "^14.6.1",
46+
"@types/codemirror": "^5.60.16",
47+
"@types/react": "^19.1.12",
4648
"babel-loader": "^10.0.0",
4749
"bpmn-js-headless": "^0.1.0",
4850
"camunda-bpmn-js": "^5.10.0",

tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
"moduleResolution": "NodeNext",
1212
"noEmit": true,
1313
"skipLibCheck": true,
14-
"typeRoots": ["./node_modules/@types", "./lib/types.d.ts"]
1514
},
16-
"include": ["lib/**/*", "lib/types.d.ts"],
17-
"exclude": ["node_modules"]
15+
"include": [ "lib/**/*" ]
1816
}

0 commit comments

Comments
 (0)