build: the ES module build gets its own declarations
An ES module TypeScript consumer was given the CommonJS declarations in dist/types. With those,
`import alex2node from "alex2node"` compiled (module Node16) and then failed when Node loaded it: "The requested
module 'alex2node' does not provide an export named 'default'". The ES module build has named exports only.
tsconfig.esm.json now emits declarations next to dist/esm/*.js, under that directory's {"type": "module"}, and
"exports" selects per condition: import -> dist/esm/index.d.ts, require -> dist/types/index.d.ts. The default
import is now refused with TS1192; named imports are unchanged. "main", "module" and "types" are as before.
test/fixtures/types.mts holds the default import under @ts-expect-error, and a new test requires "types" before
"default" and a declaration for every built file. dist/: 25 files, 132,291 B -> 33 files, 155,647 B; the npm
tarball 25,125 B -> 25,837 B. npm test: 25 pass in 5.6 s.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
09b5da0992
commit
70072d39e3
13 changed files with 522 additions and 10 deletions
20
dist/esm/ActionMapping.d.ts
vendored
Normal file
20
dist/esm/ActionMapping.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export declare enum AlexaActions {
|
||||
Open = "Alexa.Actions.Open",
|
||||
Close = "Alexa.Actions.Close",
|
||||
Raise = "Alexa.Actions.Raise",
|
||||
Lower = "Alexa.Actions.Lower",
|
||||
SetEcoOn = "Alexa.Actions.SetEcoOn",
|
||||
SetEcoOff = "Alexa.Actions.SetEcoOff"
|
||||
}
|
||||
interface Directive {
|
||||
name: string;
|
||||
payload?: string;
|
||||
}
|
||||
export declare class ActionMapping {
|
||||
type: string;
|
||||
actions: AlexaActions[];
|
||||
directive: Directive;
|
||||
constructor(actions: AlexaActions[], directiveName: string, directivePayload?: string);
|
||||
toJSON(): object;
|
||||
}
|
||||
export {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue