Skip to content

fix: tsc noEmit #477

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

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ es
coverage
yarn.lock
package-lock.json
bun.lockb

# dumi
.umi
Expand Down
6 changes: 4 additions & 2 deletions docs/examples/case.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import type { CSSMotionProps } from 'rc-motion';
import type { BuildInPlacements } from 'rc-trigger';
import type { ActionType, BuildInPlacements } from 'rc-trigger';
import Trigger from 'rc-trigger';
import './case.less';

Expand Down Expand Up @@ -115,6 +115,8 @@ const Demo = () => {
click,
contextMenu,
};

const actionsKeys = Object.keys(actions).filter((action) => actions[action]) as ActionType[];

return (
<React.StrictMode>
Expand Down Expand Up @@ -203,7 +205,7 @@ const Demo = () => {
maskMotion={motion ? MaskMotion : null}
maskClosable={maskClosable}
stretch={stretch}
action={Object.keys(actions).filter((action) => actions[action])}
action={actionsKeys}
builtinPlacements={builtinPlacements}
forceRender={forceRender}
popupStyle={{
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/nested.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Test = () => {
getPopupContainer={() => containerRef.current}
popup={<div style={popupBorderStyle}>I am inner Trigger Popup</div>}
>
<span href="#" style={{ margin: 20 }}>
<span style={{ margin: 20 }}>
clickToShowInnerTrigger
</span>
</Trigger>
Expand All @@ -94,7 +94,7 @@ const Test = () => {
builtinPlacements={builtinPlacements}
popup={<div style={popupBorderStyle}>i am a hover popup</div>}
>
<span href="#" style={{ margin: 20 }}>
<span style={{ margin: 20 }}>
trigger
</span>
</Trigger>
Expand All @@ -108,7 +108,7 @@ const Test = () => {
builtinPlacements={builtinPlacements}
popup={innerTrigger}
>
<span href="#" style={{ margin: 20 }}>
<span style={{ margin: 20 }}>
trigger
</span>
</Trigger>
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/point.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-console:0 */

import React from 'react';
import Trigger from 'rc-trigger';
import Trigger, { ActionType } from 'rc-trigger';
import '../../assets/index.less';
import './point.less';

Expand All @@ -17,7 +17,7 @@ const innerTrigger = (

class Test extends React.Component {
state = {
action: 'click',
action: 'click' as ActionType,
mouseEnterDelay: 0,
};

Expand Down
34 changes: 5 additions & 29 deletions docs/examples/simple.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint no-console:0 */

import Trigger from 'rc-trigger';
import Trigger, { ActionType } from 'rc-trigger';
import React from 'react';
import '../../assets/index.less';

Expand Down Expand Up @@ -199,6 +199,9 @@ class Test extends React.Component<any, TestState> {
if (state.destroyed) {
return null;
}

const actions = Object.keys(state.trigger) as ActionType[]

return (
<div>
<div style={{ margin: '10px 20px' }}>
Expand Down Expand Up @@ -359,7 +362,7 @@ class Test extends React.Component<any, TestState> {
maskAnimation="fade"
// mouseEnterDelay={0.1}
// mouseLeaveDelay={0.1}
action={Object.keys(state.trigger)}
action={actions}
builtinPlacements={builtinPlacements}
arrow
popupStyle={{
Expand All @@ -370,33 +373,6 @@ class Test extends React.Component<any, TestState> {
}}
popup={<div>i am a popup</div>}
popupTransitionName={state.transitionName}
mobile={
state.mobile
? {
popupMotion: {
motionName: 'rc-trigger-popup-mobile-fade',
},
popupClassName: 'rc-trigger-popup-mobile',
popupStyle: {
padding: 16,
borderTop: '1px solid red',
background: '#FFF',
textAlign: 'center',
},
popupRender: (node) => (
<>
<div>
<input
style={{ width: '100%' }}
placeholder="additional content"
/>
</div>
{node}
</>
),
}
: null
}
>
<RefTarget />
</Trigger>
Expand Down
Loading