Skip to content

Commit

Permalink
fix: restore autofocus manually for now
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Dec 8, 2023
1 parent 4d4979c commit dac6a40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/createComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ type AllWebComponentProps<I extends HTMLElement, E extends EventNames = {}> = I
? ThemedWebComponentProps<I, E>
: _WebComponentProps<I, E>;

type OmittedWebComponentProps = Omit<HTMLElement, keyof React.HTMLAttributes<any>> & ControllerMixinClass;
// TODO: LoginOverlay has "autofocus" property so we can't omit it
type OmittedWebComponentProps = Omit<HTMLElement, keyof React.HTMLAttributes<any> | 'autofocus'> & ControllerMixinClass;

export type WebComponentProps<I extends HTMLElement, E extends EventNames = {}> = Omit<
AllWebComponentProps<I, E>,
Expand Down
5 changes: 5 additions & 0 deletions test/typings/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { LitElement } from 'lit';
import { GridColumn, GridColumnElement } from '../../GridColumn.js';
import { Dialog, DialogElement } from '../../Dialog.js';
import { DatePicker, DatePickerElement } from '../../DatePicker.js';
import { LoginOverlay, LoginOverlayElement } from '../../LoginOverlay.js';
import { TimePicker, type TimePickerChangeEvent } from '../../TimePicker.js';
import { TextArea, TextAreaElement, type TextAreaChangeEvent } from '../../TextArea.js';
import { MessageInput, MessageInputElement, type MessageInputSubmitEvent } from '../../MessageInput.js';
Expand Down Expand Up @@ -93,3 +94,7 @@ const textAreaOnChange: typeof textAreaProps.onChange = (event) => {
const timePickerProps = React.createElement(TimePicker, {}).props;

assertType<typeof timePickerProps.onChange>((_event: TimePickerChangeEvent) => {});

const loginOverlayProps = React.createElement(LoginOverlay, {}).props;

assertType<LoginOverlayElement['autofocus'] | undefined>(loginOverlayProps.autofocus);

0 comments on commit dac6a40

Please sign in to comment.