Port PR #62628: Add Date.toTemporalInstant to getScriptTargetFeatures#2810
Merged
jakebailey merged 3 commits intomainfrom Feb 18, 2026
Merged
Port PR #62628: Add Date.toTemporalInstant to getScriptTargetFeatures#2810jakebailey merged 3 commits intomainfrom
jakebailey merged 3 commits intomainfrom
Conversation
…poral support Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Port add lib.esnext.temporal changes from TypeScript
Port PR #62628: Add Date.toTemporalInstant to getScriptTargetFeatures
Feb 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ports TypeScript PR #62628, which improves the error diagnostic for Date.toTemporalInstant() when the appropriate library target is not configured. Previously, accessing this method produced a generic TS2339 "Property does not exist" error. With this change, it now produces a helpful TS2550 error that suggests changing the 'lib' compiler option to 'esnext' or later.
Changes:
- Added
Dateentry to the feature map ininternal/checker/utilities.gowithtoTemporalInstantmapped to theesnextlibrary - Baseline test outputs updated to reflect the improved diagnostic (TS2339 → TS2550)
- Baseline diff file reduced, showing better convergence with TypeScript's reference implementation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/checker/utilities.go |
Added Date entry to getFeatureMap with toTemporalInstant property mapped to esnext library |
testdata/baselines/reference/submodule/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt |
Updated baseline showing improved error diagnostic (TS2550 with library suggestion instead of generic TS2339) |
testdata/baselines/reference/submodule/compiler/doYouNeedToChangeYourTargetLibraryES2016Plus.errors.txt.diff |
Reduced diff file showing convergence with TypeScript reference implementation |
DanielRosenwasser
approved these changes
Feb 17, 2026
Member
DanielRosenwasser
approved these changes
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The lib declarations for
esnext.temporalandesnext.datewere already ported, but thegetFeatureMapininternal/checker/utilities.gowas missing theDateentry. Without it,Date.toTemporalInstant()produces a generic "property does not exist" error instead of the helpful "Do you need to change your target library?" diagnostic.Date→{esnext: ["toTemporalInstant"]}entry togetFeatureMapdoYouNeedToChangeYourTargetLibraryES2016Plusreduced as expected💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.