radashi-org / radashi

The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.
https://radashi.js.org
MIT License
315 stars 25 forks source link

`omit` should accept `readonly` arrays #267

Closed aleclarson closed 1 month ago

aleclarson commented 1 month ago

From https://github.com/sodiray/radash/issues/429 by @matthew-holder-revvity

A common pattern for building unions of keys is to first define an as const tuple/array of them then using (typeof arr)[number] to determine the value type. Since those arrays are read-only, they cannot be used with omit.

PR welcome!

shan-shaji commented 1 month ago

@aleclarson , Can i work on this?

shan-shaji commented 1 month ago

Hey @MarlonPassos-git , Do you know why I am getting this error when running vitest test?

 Error: Cannot find module @rollup/rollup-darwin-arm64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (/Users/jisjoe/Documents/shan/radashi/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js:59:9)
    at Object.<anonymous> (/Users/jisjoe/Documents/shan/radashi/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js:68:76)
    ... 3 lines matching cause stack trace ...
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:530:24) {
  [cause]: Error: Cannot find module '@rollup/rollup-darwin-arm64'
  Require stack:
  - /Users/jisjoe/Documents/shan/radashi/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js
      at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
      at Function.Module._load (node:internal/modules/cjs/loader:873:27)
      at Module.require (node:internal/modules/cjs/loader:1100:19)
      at require (node:internal/modules/cjs/helpers:119:18)
      at requireWithFriendlyError (/Users/jisjoe/Documents/shan/radashi/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js:41:10)
      at Object.<anonymous> (/Users/jisjoe/Documents/shan/radashi/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js:68:76)
      at Module._compile (node:internal/modules/cjs/loader:1198:14)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
      at Module.load (node:internal/modules/cjs/loader:1076:32)
      at Function.Module._load (node:internal/modules/cjs/loader:911:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/Users/jisjoe/Documents/shan/radashi/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js'
    ]
  }
}
MarlonPassos-git commented 1 month ago

@shan-shaji Strange. Can you provide your OS information? You have used pnpm to install the dependencies?

MarlonPassos-git commented 1 month ago

Anyway, you can choose to use dev Container to develop your contributions. In the project, we configure an environment fully ready to run the project.

shan-shaji commented 1 month ago

Hey @MarlonPassos-git , I used pnpm to install the dependencies, but when I run pnpm test, I encounter the following error.

Screenshot 2024-10-18 at 10 26 18 PM

shan-shaji commented 1 month ago

Anyway, you can choose to use dev Container to develop your contributions. In the project, we configure an environment fully ready to run the project.

Cool thanks @MarlonPassos-git will try that.

MarlonPassos-git commented 1 month ago

Resolved at https://github.com/radashi-org/radashi/pull/272