Skip to content

Commit b6d965f

Browse files
metatickmichael
andauthored
fix: Langs extension types fix (#750)
* Fix typings in gen-langs-map.cjs * Fix LanguageName typing --------- Co-authored-by: michael <[email protected]>
1 parent 212172d commit b6d965f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

www/src/pages/home/Example.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { type Extension } from '@codemirror/state';
66
import CodeMirror, { ReactCodeMirrorProps, BasicSetupOptions } from '@uiw/react-codemirror';
77
import styled from 'styled-components';
88
import * as alls from '@uiw/codemirror-themes-all';
9-
import { langs } from '@uiw/codemirror-extensions-langs';
9+
import { langs, LanguageName } from '@uiw/codemirror-extensions-langs';
1010
import { Select } from './Select';
1111
import { Options } from '../extensions/basic-setup/example';
1212
import { useTheme } from '../../utils/useTheme';
@@ -69,7 +69,7 @@ export default function Example() {
6969
crosshairCursor: false,
7070
});
7171

72-
function handleLangChange(lang: string) {
72+
function handleLangChange(lang: LanguageName) {
7373
try {
7474
import(`code-example/txt/sample.${lang.toLocaleLowerCase()}.txt`)
7575
.then((data) => {
@@ -125,7 +125,7 @@ export default function Example() {
125125
label="Lang"
126126
options={Object.keys(langs).sort()}
127127
value={mode}
128-
onChange={(evn) => handleLangChange(evn.target.value)}
128+
onChange={(evn) => handleLangChange(evn.target.value as LanguageName)}
129129
/>
130130
<Select
131131
label="Website Theme"

0 commit comments

Comments
 (0)