-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(errors):
ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
cb549e9
commit c6305f8
Showing
8 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* @file Fixtures - JS_MODULE_DATA_URL | ||
* @module fixtures/JS_MODULE_DATA_URL | ||
*/ | ||
|
||
/** | ||
* JavaScript module `data:` URL. | ||
* | ||
* @const {string} JS_MODULE_DATA_URL | ||
*/ | ||
const JS_MODULE_DATA_URL: string = 'data:text/javascript,export{}' | ||
|
||
export default JS_MODULE_DATA_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/errors/__tests__/err-import-attribute-type-incompatible.spec-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* @file Type Tests - ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE | ||
* @module errnode/errors/tests/unit-d/ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE | ||
*/ | ||
|
||
import { codes } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/interfaces' | ||
import type * as TestSubject from '../err-import-attribute-type-incompatible' | ||
|
||
describe('unit-d:errors/ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE', () => { | ||
describe('ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE', () => { | ||
it('should be ErrImportAttributeTypeIncompatibleConstructor', () => { | ||
// Arrange | ||
type Expect = TestSubject.ErrImportAttributeTypeIncompatibleConstructor | ||
|
||
// Expect | ||
expectTypeOf<typeof TestSubject.default>().toEqualTypeOf<Expect>() | ||
}) | ||
}) | ||
|
||
describe('ErrImportAttributeTypeIncompatible', () => { | ||
it('should extend NodeError<codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE>', () => { | ||
// Arrange | ||
type Expect = NodeError<codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE> | ||
|
||
// Expect | ||
expectTypeOf<TestSubject.ErrImportAttributeTypeIncompatible>() | ||
.toMatchTypeOf<Expect>() | ||
}) | ||
|
||
it('should extend TypeError', () => { | ||
expectTypeOf<TestSubject.ErrImportAttributeTypeIncompatible>() | ||
.toMatchTypeOf<TypeError>() | ||
}) | ||
}) | ||
|
||
describe('ErrImportAttributeTypeIncompatibleConstructor', () => { | ||
it('should match NodeErrorConstructor', () => { | ||
// Arrange | ||
type T = TestSubject.ErrImportAttributeTypeIncompatible | ||
type Args = TestSubject.ErrImportAttributeTypeIncompatibleArgs | ||
|
||
// Expect | ||
expectTypeOf<TestSubject.ErrImportAttributeTypeIncompatibleConstructor>() | ||
.toMatchTypeOf<NodeErrorConstructor<T, Args>>() | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** | ||
* @file Errors - ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE | ||
* @module errnode/errors/ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE | ||
* @see https://github.com/nodejs/node/blob/v22.7.0/lib/internal/errors.js#L1342-L1343 | ||
*/ | ||
|
||
import E from '#e' | ||
import { codes } from '#src/enums' | ||
import type { NodeError, NodeErrorConstructor } from '#src/interfaces' | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` schema. | ||
* | ||
* @see {@linkcode NodeError} | ||
* @see https://nodejs.org/api/errors.html#err_import_attribute_type_incompatible | ||
* | ||
* @extends {NodeError<codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE>} | ||
* @extends {TypeError} | ||
*/ | ||
interface ErrImportAttributeTypeIncompatible | ||
extends NodeError<codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE>, TypeError {} | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` message arguments. | ||
*/ | ||
type Args = [id: string, type: string] | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` constructor. | ||
* | ||
* @see {@linkcode Args} | ||
* @see {@linkcode ErrImportAttributeTypeIncompatible} | ||
* @see {@linkcode NodeErrorConstructor} | ||
* | ||
* @extends {NodeErrorConstructor<ErrImportAttributeTypeIncompatible,Args>} | ||
*/ | ||
interface ErrImportAttributeTypeIncompatibleConstructor | ||
extends NodeErrorConstructor<ErrImportAttributeTypeIncompatible, Args> { | ||
/** | ||
* Create a new `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` error. | ||
* | ||
* @see {@linkcode ErrImportAttributeTypeIncompatible} | ||
* | ||
* @param {string} id | ||
* Module id | ||
* @param {string} type | ||
* Specified type | ||
* @return {ErrImportAttributeTypeIncompatible} | ||
*/ | ||
new (id: string, type: string): ErrImportAttributeTypeIncompatible | ||
} | ||
|
||
/** | ||
* `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` model. | ||
* | ||
* Thrown when an import `type` attribute is provided, but the specified module | ||
* is of a different type. | ||
* | ||
* @see {@linkcode ErrImportAttributeTypeIncompatibleConstructor} | ||
* | ||
* @type {ErrImportAttributeTypeIncompatibleConstructor} | ||
* | ||
* @class | ||
*/ | ||
const ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE: | ||
ErrImportAttributeTypeIncompatibleConstructor = E( | ||
codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE, | ||
TypeError, | ||
'Module "%s" is not of type "%s"' | ||
) | ||
|
||
export { | ||
ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE as default, | ||
type ErrImportAttributeTypeIncompatible, | ||
type Args as ErrImportAttributeTypeIncompatibleArgs, | ||
type ErrImportAttributeTypeIncompatibleConstructor | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters