-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Import assertion #40698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Import assertion #40698
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
e1b3b78
Add parsing
Kingwl 66d2273
fix all api
Kingwl 5f3cea6
check gramma of import call
Kingwl 5a1af04
Add more part of assertion
Kingwl 4b51ca9
Add some case
Kingwl 375b433
Add baseline
Kingwl 41a881c
use module insted of target
Kingwl 46a3eb1
strip assertion in d.ts
Kingwl a484ea2
Merge branch 'master' into import_assertion
Kingwl d64f7ba
Merge branch 'master' into import_assertion
Kingwl 68c8c5d
Merge branch 'master' into import_assertion
Kingwl 29fe0d3
Merge branch 'master' into import_assertion
Kingwl adcfd1b
Update new baseline
Kingwl fb01eb3
Merge branch 'master' into import_assertion
Kingwl 4f22a60
accept baseline
Kingwl f5e594d
Revert error number changes
Kingwl 60434d1
Update diagnostic message
Kingwl ff87d3e
Accept baseline
Kingwl 43b67b9
Merge branch 'master' into import_assertion
Kingwl c69a05b
rename path
Kingwl d1c48b5
Fix cr issues
Kingwl d14f93a
Accept baseline
Kingwl aa8b856
Accept baseline
Kingwl 7a5ec34
Merge branch 'master' into import_assertion
Kingwl 9cea9cf
Error if assertion and typeonly import
Kingwl 6337a7e
Merge branch 'main' into import_assertion
Kingwl eee2cab
Accept baseline
Kingwl 2857d69
Merge branch 'main' into import_assertion
Kingwl 88e39d5
Make lint happy
Kingwl f941d92
Merge branch 'main' into import_assertion
Kingwl 106ff06
Add some comment
Kingwl 7df4964
Merge branch 'main' into import_assertion
Kingwl 6ea3c55
Fix cr issues
Kingwl fc51c42
Fix more issue
Kingwl bf7ca71
Incorporate PR feedback, fix module resolution for import()
rbuckton 463138a
Merge branch 'main' into import_assertion
rbuckton b07c6e9
Add contextual type and completions for ImportCall options argument
rbuckton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add some case
- Loading branch information
commit 4b51ca9dd846e7bb657e1b11aed00193ee297d7b
There are no files selected for viewing
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
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
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
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
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
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
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
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
66 changes: 66 additions & 0 deletions
66
tests/baselines/reference/importAssertion1(target=es2020).errors.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
tests/cases/conformance/esnext/importAssertion/1.ts(1,14): error TS2796: Import assertions are not available when targeting lower than esnext. | ||
tests/cases/conformance/esnext/importAssertion/1.ts(2,28): error TS2796: Import assertions are not available when targeting lower than esnext. | ||
tests/cases/conformance/esnext/importAssertion/1.ts(3,28): error TS2796: Import assertions are not available when targeting lower than esnext. | ||
tests/cases/conformance/esnext/importAssertion/2.ts(1,28): error TS2796: Import assertions are not available when targeting lower than esnext. | ||
tests/cases/conformance/esnext/importAssertion/2.ts(2,38): error TS2796: Import assertions are not available when targeting lower than esnext. | ||
tests/cases/conformance/esnext/importAssertion/3.ts(2,11): error TS1324: Dynamic import must have one specifier as an argument. | ||
tests/cases/conformance/esnext/importAssertion/3.ts(3,11): error TS1324: Dynamic import must have one specifier as an argument. | ||
tests/cases/conformance/esnext/importAssertion/3.ts(4,11): error TS1324: Dynamic import must have one specifier as an argument. | ||
tests/cases/conformance/esnext/importAssertion/3.ts(6,11): error TS1324: Dynamic import must have one specifier as an argument. | ||
tests/cases/conformance/esnext/importAssertion/3.ts(7,11): error TS1324: Dynamic import must have one specifier as an argument. | ||
tests/cases/conformance/esnext/importAssertion/3.ts(8,11): error TS1324: Dynamic import must have one specifier as an argument. | ||
|
||
|
||
==== tests/cases/conformance/esnext/importAssertion/0.ts (0 errors) ==== | ||
export const a = 1; | ||
export const b = 2; | ||
|
||
==== tests/cases/conformance/esnext/importAssertion/1.ts (3 errors) ==== | ||
import './0' assert { type: "json" } | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2796: Import assertions are not available when targeting lower than esnext. | ||
import { a, b } from './0' assert { "type": "json" } | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2796: Import assertions are not available when targeting lower than esnext. | ||
import * as foo from './0' assert { type: "json" } | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2796: Import assertions are not available when targeting lower than esnext. | ||
a; | ||
b; | ||
foo.a; | ||
foo.b; | ||
|
||
==== tests/cases/conformance/esnext/importAssertion/2.ts (2 errors) ==== | ||
import { a, b } from './0' assert {} | ||
~~~~~~~~~ | ||
!!! error TS2796: Import assertions are not available when targeting lower than esnext. | ||
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2796: Import assertions are not available when targeting lower than esnext. | ||
a; | ||
b; | ||
c; | ||
d; | ||
|
||
==== tests/cases/conformance/esnext/importAssertion/3.ts (6 errors) ==== | ||
const a = import('./0') | ||
const b = import('./0', { type: "json" }) | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1324: Dynamic import must have one specifier as an argument. | ||
const c = import('./0', { type: "json", ttype: "typo" }) | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1324: Dynamic import must have one specifier as an argument. | ||
const d = import('./0', { }) | ||
~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1324: Dynamic import must have one specifier as an argument. | ||
declare function foo(): any; | ||
const e = import('./0', foo()) | ||
~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1324: Dynamic import must have one specifier as an argument. | ||
const f = import() | ||
~~~~~~~~ | ||
!!! error TS1324: Dynamic import must have one specifier as an argument. | ||
const g = import('./0', {}, {}) | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1324: Dynamic import must have one specifier as an argument. | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.