Promise.try recently became available in Baseline 2025.
I wanted to know how can I enable this in a TypeScript project.
I'm currently using TypeScript 5.7.3 and have the following tsconfig.json:
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"noImplicitOverride": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true,
"jsx": "react-jsx"
},
"files": [],
"include": ["src/types/**/*.ts", "src/**/*.ts", "src/**/*.tsx"],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
tsconfig.base.json:
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"esModuleInterop": true,
"target": "ES2024",
"module": "ESNext",
"lib": ["ES2024", "DOM", "ESNext", "ES2024.Promise"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"strict": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"types": ["node"],
"paths": {
"@alertdown/auth": ["libs/auth/src/index.ts"],
"@alertdown/common": ["libs/common/src/index.ts"],
"@alertdown/core": ["libs/core/src/index.ts"],
"@alertdown/db": ["libs/db/src/index.ts"],
"@alertdown/email": ["libs/email/src/index.ts"],
"@alertdown/google": ["libs/google/src/index.ts"],
"@alertdown/infrastructure": ["libs/infrastructure/src/index.ts"],
"@alertdown/llm": ["libs/llm/src/index.ts"],
"@alertdown/notifications": ["libs/notifications/src/index.ts"],
"@alertdown/payments": ["libs/payments/src/index.ts"],
"@alertdown/playwright": ["libs/playwright/src/index.ts"],
"@alertdown/prototyping": ["libs/prototyping/src/index.ts"],
"@alertdown/site": ["libs/site/src/index.ts"],
"@alertdown/site-domain": ["libs/site-domain/src/index.ts"],
"@alertdown/storage": ["libs/storage/src/index.ts"],
"@alertdown/stripe": ["libs/stripe/src/index.ts"],
"@alertdown/temporal-client": ["libs/temporal-client/src/index.ts"],
"@alertdown/ui": ["libs/ui/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
}
I thought ESNext would cover all the cases or ES2024 would do.
I get:
Property 'try' does not exist on type 'PromiseConstructor'.ts(2339)
I could potentially augment Promise, but I'd like to avoid it as it's part of the spec.
Any ideas?