|
| 1 | +/** |
| 2 | + * @file Errors - ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE |
| 3 | + * @module errnode/errors/ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE |
| 4 | + * @see https://github.com/nodejs/node/blob/v22.7.0/lib/internal/errors.js#L1342-L1343 |
| 5 | + */ |
| 6 | + |
| 7 | +import E from '#e' |
| 8 | +import { codes } from '#src/enums' |
| 9 | +import type { NodeError, NodeErrorConstructor } from '#src/interfaces' |
| 10 | + |
| 11 | +/** |
| 12 | + * `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` schema. |
| 13 | + * |
| 14 | + * @see {@linkcode NodeError} |
| 15 | + * @see https://nodejs.org/api/errors.html#err_import_attribute_type_incompatible |
| 16 | + * |
| 17 | + * @extends {NodeError<codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE>} |
| 18 | + * @extends {TypeError} |
| 19 | + */ |
| 20 | +interface ErrImportAttributeTypeIncompatible |
| 21 | + extends NodeError<codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE>, TypeError {} |
| 22 | + |
| 23 | +/** |
| 24 | + * `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` message arguments. |
| 25 | + */ |
| 26 | +type Args = [id: string, type: string] |
| 27 | + |
| 28 | +/** |
| 29 | + * `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` constructor. |
| 30 | + * |
| 31 | + * @see {@linkcode Args} |
| 32 | + * @see {@linkcode ErrImportAttributeTypeIncompatible} |
| 33 | + * @see {@linkcode NodeErrorConstructor} |
| 34 | + * |
| 35 | + * @extends {NodeErrorConstructor<ErrImportAttributeTypeIncompatible,Args>} |
| 36 | + */ |
| 37 | +interface ErrImportAttributeTypeIncompatibleConstructor |
| 38 | + extends NodeErrorConstructor<ErrImportAttributeTypeIncompatible, Args> { |
| 39 | + /** |
| 40 | + * Create a new `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` error. |
| 41 | + * |
| 42 | + * @see {@linkcode ErrImportAttributeTypeIncompatible} |
| 43 | + * |
| 44 | + * @param {string} id |
| 45 | + * Module id |
| 46 | + * @param {string} type |
| 47 | + * Specified type |
| 48 | + * @return {ErrImportAttributeTypeIncompatible} |
| 49 | + */ |
| 50 | + new (id: string, type: string): ErrImportAttributeTypeIncompatible |
| 51 | +} |
| 52 | + |
| 53 | +/** |
| 54 | + * `ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE` model. |
| 55 | + * |
| 56 | + * Thrown when an import `type` attribute is provided, but the specified module |
| 57 | + * is of a different type. |
| 58 | + * |
| 59 | + * @see {@linkcode ErrImportAttributeTypeIncompatibleConstructor} |
| 60 | + * |
| 61 | + * @type {ErrImportAttributeTypeIncompatibleConstructor} |
| 62 | + * |
| 63 | + * @class |
| 64 | + */ |
| 65 | +const ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE: |
| 66 | + ErrImportAttributeTypeIncompatibleConstructor = E( |
| 67 | + codes.ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE, |
| 68 | + TypeError, |
| 69 | + 'Module "%s" is not of type "%s"' |
| 70 | + ) |
| 71 | + |
| 72 | +export { |
| 73 | + ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE as default, |
| 74 | + type ErrImportAttributeTypeIncompatible, |
| 75 | + type Args as ErrImportAttributeTypeIncompatibleArgs, |
| 76 | + type ErrImportAttributeTypeIncompatibleConstructor |
| 77 | +} |
0 commit comments