fix: use `isolatedModules: true` in tsconfig.json (#469)

* fix: use `isolatedModules: true` in tsconfig.json

This setting ensures the module can be used in projects where the workflow
includes type checking and transpilation as two separate steps.

See: https://ncjamieson.com/dont-export-const-enums/

Fixes: https://github.com/cloudevents/sdk-javascript/issues/456

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2022-02-10 07:39:09 -06:00 committed by GitHub
parent f36a1f0428
commit b5c0b56f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 17 deletions

View File

@ -17,30 +17,33 @@ import CONSTANTS from "./constants";
export { export {
// From event // From event
CloudEvent, CloudEvent,
CloudEventV1,
CloudEventV1Attributes,
Version, Version,
ValidationError, ValidationError,
Mode,
HTTP,
Kafka,
MQTT,
MQTTMessageFactory,
emitterFor,
Emitter,
// From Constants
CONSTANTS
};
export type {
CloudEventV1,
CloudEventV1Attributes,
// From message // From message
Headers, Headers,
Mode,
Binding, Binding,
Message, Message,
Deserializer, Deserializer,
Serializer, Serializer,
HTTP,
Kafka,
KafkaEvent, KafkaEvent,
KafkaMessage, KafkaMessage,
MQTT,
MQTTMessage, MQTTMessage,
MQTTMessageFactory,
// From transport // From transport
TransportFunction, TransportFunction,
EmitterFunction, EmitterFunction,
emitterFor, Options
Emitter,
Options,
// From Constants
CONSTANTS,
}; };

View File

@ -10,7 +10,10 @@ import { sanitize } from "../http/headers";
// Export the binding implementation and message interface // Export the binding implementation and message interface
export { export {
Kafka, Kafka
};
export type {
KafkaMessage, KafkaMessage,
KafkaEvent KafkaEvent
}; };

View File

@ -6,10 +6,9 @@
import { Binding, Deserializer, CloudEvent, CloudEventV1, CONSTANTS, Message, ValidationError, Headers } from "../.."; import { Binding, Deserializer, CloudEvent, CloudEventV1, CONSTANTS, Message, ValidationError, Headers } from "../..";
export { export {
MQTT, MQTT, MQTTMessageFactory
MQTTMessage,
MQTTMessageFactory
}; };
export type { MQTTMessage };
/** /**
* Extends the base {@linkcode Message} interface to include MQTT attributes, some of which * Extends the base {@linkcode Message} interface to include MQTT attributes, some of which

View File

@ -11,7 +11,8 @@
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"outDir": "./dist", "outDir": "./dist",
"declaration": true, "declaration": true,
"experimentalDecorators": true "experimentalDecorators": true,
"isolatedModules": true,
}, },
"compileOnSave": true, "compileOnSave": true,
"include": [ "include": [