endo icon indicating copy to clipboard operation
endo copied to clipboard

Add a note about required `compilerOptions.lib` or `compilerOptions.target` to SES readme

Open adamscybot opened this issue 9 months ago • 0 comments

What is the Problem Being Solved?

Since the use of AggregateErrorConstructor was added you need to be using at least es2021 (or more granular, es2021.promise) in the compilerOptions.lib of the tsconfig.json on the consuming project for it to compile.

If the consumer doesn't use the compilerOptions.lib option, TS infers sensible defaults from the compilerOptions.target and I determined es2021 is also the target that is the least required in that scenario.

Note there was another definition added in es2022.error. Not sure which one is relevant, or maybe both are.

This took me some time to understand where this was supposed to be coming from. Probably just a note in the docs about the required support and relevant TS config would suffice.

I think there are other options here but I haven't put too much thought into if they are appropriate. However, they could nuke it entirely from being a consumer concern:

  • Use /// <reference lib="es2021.promise" /> in types.d.ts. I think this also includes it in the consuming project though.
  • (typeof globalThis)['AggregateErrorConstructor'] lets you see if it's there and potentially use a conditional type to dynamically not include it if it's not available which may or may not make sense depending on the SES API around this feature.

Description of the Design

N/A

Security Considerations

N/A

Scaling Considerations

N/A

Test Plan

N/A

Compatibility Considerations

N/A

Upgrade Considerations

N/A

adamscybot avatar May 06 '24 20:05 adamscybot