Skip to content

Commit

Permalink
feat: add new generic type to ArrayType's Shift
Browse files Browse the repository at this point in the history
  • Loading branch information
kakasoo committed Jul 21, 2024
1 parent c9adfb7 commit a7d0ea1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 20.x
registry-url: 'https://npm.pkg.github.com'
- name: Root Install
run: npm i
- name: Publish
run: |
git pull
npm i
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm version patch
npm run deploy
npm publish
git add package*
git commit -m "Bump version to $(jq -r .version package.json) [skip ci]"
git push --set-upstream origin main --follow-tags
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@kakasoo/proto-typescript",
"version": "1.28.1",
"publishConfig": {
"access": "public"
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"description": "Utility types and implementations based on JavaScript prototypes.",
"main": "./dist/index.js",
Expand Down
7 changes: 6 additions & 1 deletion src/types/array.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ export namespace ArrayType {
/**
* Shift<[1,2,3]> // [2,3]
*/
export type Shift<T extends ReadonlyOrNot<any[]>> = T extends [infer F, ...infer Rest] ? Rest : [];
export type Shift<T extends ReadonlyOrNot<any[]>, N extends number> = T extends [
...infer F extends NTuple<N>,
...infer Rest,
]
? Rest
: [];

/**
* Unshift<[1, 2, 3], 4> // [4,1,2,3]
Expand Down

0 comments on commit a7d0ea1

Please sign in to comment.