Skip to content

Commit

Permalink
fix: incorrect extractProperties typings for known object
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Aug 29, 2022
1 parent dba496d commit b6dc374
Show file tree
Hide file tree
Showing 6 changed files with 1,803 additions and 2,567 deletions.
56 changes: 13 additions & 43 deletions package.json
Expand Up @@ -5,37 +5,6 @@
"description": "Perform async work synchronously in Node.js using `worker_threads` with first-class TypeScript support.",
"repository": "git+https://github.com/un-ts/synckit.git",
"author": "JounQin (https://www.1stG.me) <admin@1stg.me>",
"donate": {
"recipients": [
{
"name": "unts",
"platform": "opencollective",
"address": "https://opencollective.com/unts",
"weight": 60
},
{
"name": "rxts",
"platform": "opencollective",
"address": "https://opencollective.com/rxts",
"weight": 20
},
{
"name": "1stG",
"email": "i@1stg.me",
"weight": 20,
"platforms": [
{
"platform": "opencollective",
"address": "https://opencollective.com/1stG"
},
{
"platform": "patreon",
"address": "https://www.patreon.com/1stG"
}
]
}
]
},
"funding": "https://opencollective.com/unts",
"license": "MIT",
"packageManager": "yarn@1.22.19",
Expand Down Expand Up @@ -79,35 +48,36 @@
"lint:tsc": "tsc --noEmit",
"prepare": "patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prerelease": "yarn build",
"release": "changeset publish",
"release": "clean-pkg-json && changeset publish",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"typecov": "type-coverage"
},
"dependencies": {
"@pkgr/utils": "^2.3.0",
"@pkgr/utils": "^2.3.1",
"tslib": "^2.4.0"
},
"devDependencies": {
"@1stg/lib-config": "^9.0.2",
"@1stg/lib-config": "^10.2.1",
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.23.2",
"@changesets/cli": "^2.24.3",
"@swc-node/register": "^1.5.1",
"@types/jest": "^28.1.5",
"@types/node": "^18.0.4",
"deasync": "^0.1.27",
"@types/jest": "^28.1.8",
"@types/node": "^18.7.13",
"clean-pkg-json": "^1.2.0",
"deasync": "^0.1.28",
"esbuild-register": "^3.3.3",
"esbuild-runner": "^2.2.1",
"execa": "^6.1.0",
"jest": "^28.1.3",
"jest": "^29.0.1",
"patch-package": "^6.4.7",
"sync-threads": "^1.0.1",
"ts-expect": "^1.3.0",
"ts-jest": "^28.0.6",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"tsx": "^3.8.0",
"tsx": "^3.8.2",
"type-coverage": "^2.22.0",
"typescript": "^4.7.4",
"yarn-deduplicate": "^5.0.0"
"typescript": "^4.8.2",
"yarn-deduplicate": "^6.0.0"
},
"resolutions": {
"prettier": "^2.7.1"
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Expand Up @@ -76,9 +76,11 @@ export interface SynckitOptions {
// MessagePort doesn't copy the properties of Error objects. We still want
// error objects to have extra properties such as "warnings" so implement the
// property copying manually.
export const extractProperties = <T>(object?: T): T | undefined => {
export function extractProperties<T extends object>(object: T): T
export function extractProperties<T>(object?: T): T | undefined
export function extractProperties<T>(object?: T) {
if (object && typeof object === 'object') {
const properties = {} as unknown as T
const properties = {} as T
for (const key in object) {
properties[key as keyof T] = object[key]
}
Expand Down
783 changes: 0 additions & 783 deletions test/fixtures/yarn-pnp/.yarn/releases/yarn-3.2.2.cjs

This file was deleted.

4 changes: 3 additions & 1 deletion test/fixtures/yarn-pnp/.yarnrc.yml
@@ -1,3 +1,5 @@
nodeLinker: pnp

pnpEnableEsmLoader: true
yarnPath: .yarn/releases/yarn-3.2.2.cjs

yarnPath: .yarn/releases/yarn-3.2.3.cjs
2 changes: 1 addition & 1 deletion test/fixtures/yarn-pnp/package.json
Expand Up @@ -3,6 +3,6 @@
"version": "1.0.0",
"type": "module",
"license": "MIT",
"packageManager": "yarn@3.2.2",
"packageManager": "yarn@3.2.3",
"main": "index.js"
}

0 comments on commit b6dc374

Please sign in to comment.