Skip to content

fix(src):fix some ts error hint #2134

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

Open
wants to merge 1 commit into
base: 6.x
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions src/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export function KeyedCollection(

export class KeyedCollectionImpl<K, V> extends CollectionImpl<K, V> {}

export function IndexedCollection<T>(
value: Iterable<T> | ArrayLike<T>
): IndexedCollectionImpl<T> {
export function IndexedCollection(
value: Iterable<unknown> | ArrayLike<unknown>
): IndexedCollectionImpl<unknown> {
return isIndexed(value) ? value : IndexedSeq(value);
}

Expand Down
6 changes: 3 additions & 3 deletions src/predicates/isKeyed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function isKeyed(
): maybeKeyed is KeyedCollectionImpl<unknown, unknown> {
return Boolean(
maybeKeyed &&
// @ts-expect-error: maybeKeyed is typed as `{}`, need to change in 6.0 to `maybeKeyed && typeof maybeKeyed === 'object' && IS_KEYED_SYMBOL in maybeKeyed`
maybeKeyed[IS_KEYED_SYMBOL]
);
typeof maybeKeyed === 'object' &&
IS_KEYED_SYMBOL in maybeKeyed
)
}
8 changes: 2 additions & 6 deletions src/utils/mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ type Constructor<T = object> = new (...args: unknown[]) => T;
*/
export default function mixin<C extends Constructor>(
ctor: C,
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
methods: Record<string, Function>
methods: Record<PropertyKey, (...args: unknown[]) => unknown>
): C {
const keyCopier = (key: string | symbol): void => {
// @ts-expect-error how to handle symbol ?
ctor.prototype[key] = methods[key];
};
Object.keys(methods).forEach(keyCopier);
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here
Object.getOwnPropertySymbols &&
Object.getOwnPropertySymbols(methods).forEach(keyCopier);
Object.getOwnPropertySymbols(methods).forEach(keyCopier);
return ctor;
}
Loading