Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't init a theme with partial options in TypeScript #444

Closed
IGassmann opened this issue Jan 11, 2023 · 4 comments
Closed

Can't init a theme with partial options in TypeScript #444

IGassmann opened this issue Jan 11, 2023 · 4 comments

Comments

@IGassmann
Copy link

When trying to init a theme and passing partial options, TypeScript throws an error because the theme and styles properties are marked as required in the interface CreateThemeOptions. This can be reproduced with the following:

import { materialInit } from '@uiw/codemirror-theme-material';

<CodeMirror
  theme={materialInit({
    settings: {
      caret: '#c6c6c6',
      fontFamily: 'monospace',
    }
  })}
/>
@jaywcjlove
Copy link
Member

@IGassmann Upgrade v4.19.6

@IGassmann
Copy link
Author

@jaywcjlove latest version only partially solves the issue because it uses Partial<CreateThemeOptions> instead of something like PartialDeep<T>. Due to that, the example above still doesn't work because it isn't providing the value settings.foreground, which is marked as required by the CreateThemeOptions['settings'] type.

jaywcjlove added a commit that referenced this issue Jan 17, 2023
@jaywcjlove
Copy link
Member

@IGassmann Upgrade v4.19.7

@IGassmann
Copy link
Author

Solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants