Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1013 from matrix-org/langleyd/fix_ts_type_export
Browse files Browse the repository at this point in the history
Fix lib type export
  • Loading branch information
langleyd committed Jul 17, 2024
2 parents 6f982ac + 66d6640 commit 034afd0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions platforms/web/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ vite.demo.config.ts
scripts
cypress
example-wysiwyg
coverage
7 changes: 7 additions & 0 deletions platforms/web/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { ComposerUpdate } from '../generated/wysiwyg';
import { ACTION_TYPES, SUGGESTIONS } from './constants';
import { AllowedMentionAttributes, LinkEvent } from './useListeners/types';

Expand Down Expand Up @@ -71,3 +72,9 @@ export type MappedSuggestion = {
text: string;
type: SuggestionType;
};
export type TraceAction = (
update: ComposerUpdate | null,
name: string,
value1?: string | number,
value2?: string | number,
) => ComposerUpdate | null;
1 change: 0 additions & 1 deletion platforms/web/lib/useTestCases/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
import { useTestCases } from './useTestCases';

export type TestUtilities = ReturnType<typeof useTestCases>['utilities'];

export type SelectTuple = ['select', number, number];
export type Tuple =
| SelectTuple
Expand Down
10 changes: 2 additions & 8 deletions platforms/web/lib/useTestCases/useTestCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ limitations under the License.

import { RefObject, useCallback, useMemo, useRef, useState } from 'react';

import { ComposerModel, ComposerUpdate } from '../../generated/wysiwyg';
import { ComposerModel } from '../../generated/wysiwyg';
import { Actions } from './types';
import {
getSelectionAccordingToActions,
resetTestCase,
traceAction,
} from './utils';

export type TraceAction = (
update: ComposerUpdate | null,
name: string,
value1?: string | number,
value2?: string | number,
) => ComposerUpdate | null;
import { TraceAction } from '../types';

export type UseTestCases = {
testRef: RefObject<HTMLDivElement>;
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/lib/useTestCases/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {
new_composer_model_from_html,
} from '../../generated/wysiwyg';
import { getCurrentSelection } from '../dom';
import { TraceAction } from '../types';
import { isSelectTuple } from './assert';
import { Actions } from './types';
import { TraceAction } from './useTestCases';

export function traceAction(
testNode: HTMLElement | null,
Expand Down
2 changes: 1 addition & 1 deletion platforms/web/lib/useWysiwyg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import {
FormattingFunctions,
InputEventProcessor,
MappedSuggestion,
TraceAction,
} from './types.js';
import { useFormattingFunctions } from './useFormattingFunctions';
import { useComposerModel } from './useComposerModel';
import { useListeners } from './useListeners';
import { useTestCases } from './useTestCases';
import { mapSuggestion } from './suggestion.js';
import { TraceAction } from './useTestCases/useTestCases.js';

export { richToPlain, plainToRich } from './conversion';

Expand Down
1 change: 1 addition & 0 deletions platforms/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default defineConfig({
'lib/types.ts',
'lib/constants.ts',
'lib/useListeners/types.ts',
'lib/useTestCases/types.ts',
],
rollupTypes: true,
}),
Expand Down

0 comments on commit 034afd0

Please sign in to comment.