# class-without-call-parent-constructor

> create class skip call parent constructor

Latest version **2.0.5** (published 2022-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install class-without-call-parent-constructor
pnpm add class-without-call-parent-constructor
yarn add class-without-call-parent-constructor
bun add class-without-call-parent-constructor
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2022-08-30 |
| First published | 2021-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bluelovers |
| Maintainers | bluelovers |
| Keywords | create, class, extend, parent, super, invoke, constructor, create-by-yarn-tool, create-by-tsdx |

## Links

- npm: https://www.npmjs.com/package/class-without-call-parent-constructor
- Repository: https://github.com/bluelovers/class-without-call-parent-constructor
- Homepage: https://github.com/bluelovers/class-without-call-parent-constructor#readme
- Issues: https://github.com/bluelovers/class-without-call-parent-constructor/issues
- npm.io page: https://npm.io/package/class-without-call-parent-constructor

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.5 (latest) — 2022-08-30
- 2.0.4 — 2021-07-01
- 2.0.3 — 2021-07-01
- 2.0.2 — 2021-06-30
- 2.0.1 — 2021-06-28
- 1.0.2 — 2021-06-27

## README

```typescript
import classWithoutCallParentConstructor from 'class-without-call-parent-constructor';

describe(`describe`, () =>
{

	class A
	{
		constructor(a: any, b: any)
		{
			console.log("A.constructor");
			throw new Error('should not call A.constructor')
			a;
			b;
		}

		parentMethod()
		{
			console.log("A.parentMethod()");

			return "A.parentMethod()"
		}
	}

	test(`@ts-expect-error`, () =>
	{

		class B extends A
		{
			// @ts-expect-error
			constructor()
			{

			}
		}

		// @ts-ignore
		expect(() => new A).toThrowError();
		expect(() => new B).toThrowError();

	});

	test(`classWithoutCallParentConstructor`, () =>
	{
		class B extends classWithoutCallParentConstructor(A)
		{
			constructor()
			{
				super();
			}

			childMethod()
			{
				console.log("B.childMethod()");
				return "B.childMethod()"
			}
		}

		expect(() => new B).not.toThrowError();

		let actual = new B;

		expect(actual).toHaveProperty('parentMethod')
		expect(actual).toHaveProperty('childMethod')

		expect(actual.parentMethod()).toStrictEqual('A.parentMethod()')
		expect(actual.childMethod()).toStrictEqual('B.childMethod()')

	});

	test(`createNewTargetObject`, () =>
	{
		class B extends A
		{
			// @ts-ignore
			constructor()
			{
				return createNewTargetObject(new.target)
			}

			childMethod()
			{
				console.log("B.childMethod()");
				return "B.childMethod()"
			}
		}

		expect(() => new B).not.toThrowError();

		let actual = new B;

		expect(actual).toHaveProperty('parentMethod')
		expect(actual).toHaveProperty('childMethod')

		expect(actual.parentMethod()).toStrictEqual('A.parentMethod()')
		expect(actual.childMethod()).toStrictEqual('B.childMethod()')

	});

})

```

---
_Source: https://npm.io/package/class-without-call-parent-constructor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
