diff --git a/packages/typescript/schemas/jsconfig.schema.json b/packages/typescript/schemas/jsconfig.schema.json index a3727d802eb2a..e30a1e07b453b 100644 --- a/packages/typescript/schemas/jsconfig.schema.json +++ b/packages/typescript/schemas/jsconfig.schema.json @@ -767,6 +767,7 @@ "esnext.decorators", "esnext.disposable", "esnext.intl", + "esnext.modulesource", "esnext.sharedmemory", "esnext.temporal", "decorators", @@ -889,11 +890,12 @@ "", "", "", + "", "Deprecated." ] }, { - "pattern": "^([Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]2015|[Ee][Ss]7|[Ee][Ss]2016|[Ee][Ss]2017|[Ee][Ss]2018|[Ee][Ss]2019|[Ee][Ss]2020|[Ee][Ss]2021|[Ee][Ss]2022|[Ee][Ss]2023|[Ee][Ss]2024|[Ee][Ss]2025|[Ee][Ss]2026|[Ee][Ss][Nn][Ee][Xx][Tt]|[Dd][Oo][Mm]|[Dd][Oo][Mm]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Dd][Oo][Mm]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]|[Ee][Ss]2015\\.[Cc][Oo][Rr][Ee]|[Ee][Ss]2015\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2015\\.[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2015\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Xx][Yy]|[Ee][Ss]2015\\.[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2016\\.[Aa][Rr][Rr][Aa][Yy]\\.[Ii][Nn][Cc][Ll][Uu][Dd][Ee]|[Ee][Ss]2016\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2017\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2017\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2017\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2017\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2017\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2018\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2018\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2018\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2019\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2019\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2019\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2019\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2019\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss]2020\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2020\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2020\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2020\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2020\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2020\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Nn][Uu][Mm][Bb][Ee][Rr]|[Ee][Ss]2021\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2021\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2021\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss]2021\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2022\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2022\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2022\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2022\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2023\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2023\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2023\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2024\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2024\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2024\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2024\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2024\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2024\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2024\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2025\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2025\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss]2025\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2025\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2025\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2025\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2026\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2026\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2026\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2026\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2026\\.[Jj][Ss][Oo][Nn]|[Ee][Ss]2026\\.[Mm][Aa][Tt][Hh]|[Ee][Ss]2026\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Aa][Tt][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ii][Ss][Pp][Oo][Ss][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Nn][Tt][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Ee][Mm][Pp][Oo][Rr][Aa][Ll]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]\\.[Ll][Ee][Gg][Aa][Cc][Yy]|[Ee][Ss]2022\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy])$" + "pattern": "^([Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]2015|[Ee][Ss]7|[Ee][Ss]2016|[Ee][Ss]2017|[Ee][Ss]2018|[Ee][Ss]2019|[Ee][Ss]2020|[Ee][Ss]2021|[Ee][Ss]2022|[Ee][Ss]2023|[Ee][Ss]2024|[Ee][Ss]2025|[Ee][Ss]2026|[Ee][Ss][Nn][Ee][Xx][Tt]|[Dd][Oo][Mm]|[Dd][Oo][Mm]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Dd][Oo][Mm]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]|[Ee][Ss]2015\\.[Cc][Oo][Rr][Ee]|[Ee][Ss]2015\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2015\\.[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2015\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Xx][Yy]|[Ee][Ss]2015\\.[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2016\\.[Aa][Rr][Rr][Aa][Yy]\\.[Ii][Nn][Cc][Ll][Uu][Dd][Ee]|[Ee][Ss]2016\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2017\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2017\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2017\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2017\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2017\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2018\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2018\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2018\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2019\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2019\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2019\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2019\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2019\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss]2020\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2020\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2020\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2020\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2020\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2020\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Nn][Uu][Mm][Bb][Ee][Rr]|[Ee][Ss]2021\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2021\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2021\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss]2021\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2022\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2022\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2022\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2022\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2023\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2023\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2023\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2024\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2024\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2024\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2024\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2024\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2024\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2024\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2025\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2025\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss]2025\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2025\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2025\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2025\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2026\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2026\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2026\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2026\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2026\\.[Jj][Ss][Oo][Nn]|[Ee][Ss]2026\\.[Mm][Aa][Tt][Hh]|[Ee][Ss]2026\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Aa][Tt][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ii][Ss][Pp][Oo][Ss][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Nn][Tt][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Mm][Oo][Dd][Uu][Ll][Ee][Ss][Oo][Uu][Rr][Cc][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Ee][Mm][Pp][Oo][Rr][Aa][Ll]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]\\.[Ll][Ee][Gg][Aa][Cc][Yy]|[Ee][Ss]2022\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy])$" } ] } diff --git a/packages/typescript/schemas/tsconfig.schema.json b/packages/typescript/schemas/tsconfig.schema.json index 775f7ef86ef6a..2dedd95c43eb2 100644 --- a/packages/typescript/schemas/tsconfig.schema.json +++ b/packages/typescript/schemas/tsconfig.schema.json @@ -766,6 +766,7 @@ "esnext.decorators", "esnext.disposable", "esnext.intl", + "esnext.modulesource", "esnext.sharedmemory", "esnext.temporal", "decorators", @@ -888,11 +889,12 @@ "", "", "", + "", "Deprecated." ] }, { - "pattern": "^([Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]2015|[Ee][Ss]7|[Ee][Ss]2016|[Ee][Ss]2017|[Ee][Ss]2018|[Ee][Ss]2019|[Ee][Ss]2020|[Ee][Ss]2021|[Ee][Ss]2022|[Ee][Ss]2023|[Ee][Ss]2024|[Ee][Ss]2025|[Ee][Ss]2026|[Ee][Ss][Nn][Ee][Xx][Tt]|[Dd][Oo][Mm]|[Dd][Oo][Mm]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Dd][Oo][Mm]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]|[Ee][Ss]2015\\.[Cc][Oo][Rr][Ee]|[Ee][Ss]2015\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2015\\.[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2015\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Xx][Yy]|[Ee][Ss]2015\\.[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2016\\.[Aa][Rr][Rr][Aa][Yy]\\.[Ii][Nn][Cc][Ll][Uu][Dd][Ee]|[Ee][Ss]2016\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2017\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2017\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2017\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2017\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2017\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2018\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2018\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2018\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2019\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2019\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2019\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2019\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2019\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss]2020\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2020\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2020\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2020\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2020\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2020\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Nn][Uu][Mm][Bb][Ee][Rr]|[Ee][Ss]2021\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2021\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2021\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss]2021\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2022\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2022\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2022\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2022\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2023\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2023\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2023\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2024\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2024\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2024\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2024\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2024\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2024\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2024\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2025\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2025\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss]2025\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2025\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2025\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2025\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2026\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2026\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2026\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2026\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2026\\.[Jj][Ss][Oo][Nn]|[Ee][Ss]2026\\.[Mm][Aa][Tt][Hh]|[Ee][Ss]2026\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Aa][Tt][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ii][Ss][Pp][Oo][Ss][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Nn][Tt][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Ee][Mm][Pp][Oo][Rr][Aa][Ll]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]\\.[Ll][Ee][Gg][Aa][Cc][Yy]|[Ee][Ss]2022\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy])$" + "pattern": "^([Ee][Ss]5|[Ee][Ss]6|[Ee][Ss]2015|[Ee][Ss]7|[Ee][Ss]2016|[Ee][Ss]2017|[Ee][Ss]2018|[Ee][Ss]2019|[Ee][Ss]2020|[Ee][Ss]2021|[Ee][Ss]2022|[Ee][Ss]2023|[Ee][Ss]2024|[Ee][Ss]2025|[Ee][Ss]2026|[Ee][Ss][Nn][Ee][Xx][Tt]|[Dd][Oo][Mm]|[Dd][Oo][Mm]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Dd][Oo][Mm]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Mm][Pp][Oo][Rr][Tt][Ss][Cc][Rr][Ii][Pp][Tt][Ss]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ww][Ee][Bb][Ww][Oo][Rr][Kk][Ee][Rr]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ss][Cc][Rr][Ii][Pp][Tt][Hh][Oo][Ss][Tt]|[Ee][Ss]2015\\.[Cc][Oo][Rr][Ee]|[Ee][Ss]2015\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2015\\.[Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2015\\.[Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2015\\.[Pp][Rr][Oo][Xx][Yy]|[Ee][Ss]2015\\.[Rr][Ee][Ff][Ll][Ee][Cc][Tt]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2015\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2016\\.[Aa][Rr][Rr][Aa][Yy]\\.[Ii][Nn][Cc][Ll][Uu][Dd][Ee]|[Ee][Ss]2016\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2017\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2017\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2017\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2017\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2017\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2017\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Gg][Ee][Nn][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2018\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss]2018\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2018\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2018\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2019\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2019\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2019\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2019\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss]2019\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss]2020\\.[Dd][Aa][Tt][Ee]|[Ee][Ss]2020\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2020\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2020\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2020\\.[Ss][Yy][Mm][Bb][Oo][Ll]\\.[Ww][Ee][Ll][Ll][Kk][Nn][Oo][Ww][Nn]|[Ee][Ss]2020\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2020\\.[Nn][Uu][Mm][Bb][Ee][Rr]|[Ee][Ss]2021\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2021\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2021\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss]2021\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2022\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2022\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2022\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2022\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2022\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2023\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2023\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2023\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2024\\.[Aa][Rr][Rr][Aa][Yy][Bb][Uu][Ff][Ff][Ee][Rr]|[Ee][Ss]2024\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2024\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss]2024\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2024\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2024\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss]2024\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss]2025\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2025\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss]2025\\.[Ii][Nn][Tt][Ll]|[Ee][Ss]2025\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2025\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss]2025\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss]2026\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss]2026\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss]2026\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss]2026\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss]2026\\.[Jj][Ss][Oo][Nn]|[Ee][Ss]2026\\.[Mm][Aa][Tt][Hh]|[Ee][Ss]2026\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Ss][Yy][Nn][Cc][Ii][Tt][Ee][Rr][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Yy][Mm][Bb][Oo][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Bb][Ii][Gg][Ii][Nn][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ww][Ee][Aa][Kk][Rr][Ee][Ff]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Oo][Bb][Jj][Ee][Cc][Tt]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Rr][Ee][Gg][Ee][Xx][Pp]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Tt][Rr][Ii][Nn][Gg]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ff][Ll][Oo][Aa][Tt]16|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Aa][Rr][Rr][Aa][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Cc][Oo][Ll][Ll][Ee][Cc][Tt][Ii][Oo][Nn]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ee][Rr][Rr][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Tt][Ee][Rr][Aa][Tt][Oo][Rr]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Yy][Pp][Ee][Dd][Aa][Rr][Rr][Aa][Yy][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Pp][Rr][Oo][Mm][Ii][Ss][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Aa][Tt][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Dd][Ii][Ss][Pp][Oo][Ss][Aa][Bb][Ll][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ii][Nn][Tt][Ll]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Mm][Oo][Dd][Uu][Ll][Ee][Ss][Oo][Uu][Rr][Cc][Ee]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy]|[Ee][Ss][Nn][Ee][Xx][Tt]\\.[Tt][Ee][Mm][Pp][Oo][Rr][Aa][Ll]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]|[Dd][Ee][Cc][Oo][Rr][Aa][Tt][Oo][Rr][Ss]\\.[Ll][Ee][Gg][Aa][Cc][Yy]|[Ee][Ss]2022\\.[Ss][Hh][Aa][Rr][Ee][Dd][Mm][Ee][Mm][Oo][Rr][Yy])$" } ] } diff --git a/packages/typescript/src/api/node/encoder.generated.ts b/packages/typescript/src/api/node/encoder.generated.ts index df5572d9690aa..7b9c4de1425f6 100644 --- a/packages/typescript/src/api/node/encoder.generated.ts +++ b/packages/typescript/src/api/node/encoder.generated.ts @@ -91,7 +91,7 @@ export function getNodeCommonData(node: Node): number { case SyntaxKind.ImportType: return ((node as ImportTypeNode).isTypeOf ? 1 : 0) << 24; case SyntaxKind.ImportClause: - return ((node as ImportClause).phaseModifier === SyntaxKind.TypeKeyword ? 1 : (node as ImportClause).phaseModifier === SyntaxKind.DeferKeyword ? 2 : 0) << 24; + return ((node as ImportClause).phaseModifier === SyntaxKind.TypeKeyword ? 1 : (node as ImportClause).phaseModifier === SyntaxKind.DeferKeyword ? 2 : (node as ImportClause).phaseModifier === SyntaxKind.SourceKeyword ? 3 : 0) << 24; case SyntaxKind.ImportSpecifier: return ((node as ImportSpecifier).isTypeOnly ? 1 : 0) << 24; case SyntaxKind.JSDocTypeLiteral: diff --git a/packages/typescript/src/api/node/node.generated.ts b/packages/typescript/src/api/node/node.generated.ts index a5f2991ae0054..0f69dbc63abd3 100644 --- a/packages/typescript/src/api/node/node.generated.ts +++ b/packages/typescript/src/api/node/node.generated.ts @@ -590,7 +590,7 @@ export class RemoteNode extends RemoteNodeBase implements Node { case SyntaxKind.ImportClause: { const idx = (this.data >> 24) & 0x3; if (idx === 0) return undefined; - return idx === 1 ? SyntaxKind.TypeKeyword : idx === 2 ? SyntaxKind.DeferKeyword : undefined; + return idx === 1 ? SyntaxKind.TypeKeyword : idx === 2 ? SyntaxKind.DeferKeyword : idx === 3 ? SyntaxKind.SourceKeyword : undefined; } } } diff --git a/packages/typescript/src/ast/ast.generated.ts b/packages/typescript/src/ast/ast.generated.ts index 819fd5fd13c6f..723093189f812 100644 --- a/packages/typescript/src/ast/ast.generated.ts +++ b/packages/typescript/src/ast/ast.generated.ts @@ -159,7 +159,8 @@ export type KeywordSyntaxKind = | SyntaxKind.BigIntKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.OfKeyword - | SyntaxKind.DeferKeyword; + | SyntaxKind.DeferKeyword + | SyntaxKind.SourceKeyword; export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type KeywordExpressionSyntaxKind = SyntaxKind.NullKeyword | SyntaxKind.TrueKeyword | SyntaxKind.FalseKeyword | SyntaxKind.ThisKeyword | SyntaxKind.SuperKeyword | SyntaxKind.ImportKeyword; @@ -330,7 +331,8 @@ export type TokenSyntaxKind = | SyntaxKind.BigIntKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.OfKeyword - | SyntaxKind.DeferKeyword; + | SyntaxKind.DeferKeyword + | SyntaxKind.SourceKeyword; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFile | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; export type JSDocNodeSyntaxKind = | SyntaxKind.JSDocTypeExpression @@ -369,7 +371,7 @@ export type JSDocNodeSyntaxKind = | SyntaxKind.JSDocThrowsTag | SyntaxKind.JSDocSatisfiesTag | SyntaxKind.JSDocImportTag; -export type ImportPhaseModifierSyntaxKind = SyntaxKind.TypeKeyword | SyntaxKind.DeferKeyword; +export type ImportPhaseModifierSyntaxKind = SyntaxKind.TypeKeyword | SyntaxKind.DeferKeyword | SyntaxKind.SourceKeyword; export type PostfixUnaryOperator = SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; export type PrefixUnaryOperator = SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.TildeToken | SyntaxKind.ExclamationToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken; export type AssignmentOperator = SyntaxKind.EqualsToken | CompoundAssignmentOperator; diff --git a/packages/typescript/src/ast/is.generated.ts b/packages/typescript/src/ast/is.generated.ts index 7e529557d817c..ca0e420be64b2 100644 --- a/packages/typescript/src/ast/is.generated.ts +++ b/packages/typescript/src/ast/is.generated.ts @@ -2773,7 +2773,8 @@ export function isJsxTokenKind(kind: SyntaxKind): kind is JsxTokenSyntaxKind { export function isImportPhaseModifierKind(kind: SyntaxKind): kind is ImportPhaseModifierSyntaxKind { return kind === SyntaxKind.TypeKeyword - || kind === SyntaxKind.DeferKeyword; + || kind === SyntaxKind.DeferKeyword + || kind === SyntaxKind.SourceKeyword; } export function isPostfixUnaryOperator(kind: SyntaxKind): kind is PostfixUnaryOperator { diff --git a/packages/typescript/src/ast/scanner.ts b/packages/typescript/src/ast/scanner.ts index df3a7415cec5d..7b103bad149ca 100644 --- a/packages/typescript/src/ast/scanner.ts +++ b/packages/typescript/src/ast/scanner.ts @@ -149,6 +149,7 @@ export const textToKeywordObj: Record = { return: SyntaxKind.ReturnKeyword, satisfies: SyntaxKind.SatisfiesKeyword, set: SyntaxKind.SetKeyword, + source: SyntaxKind.SourceKeyword, static: SyntaxKind.StaticKeyword, string: SyntaxKind.StringKeyword, super: SyntaxKind.SuperKeyword, diff --git a/packages/typescript/src/enums/syntaxKind.enum.ts b/packages/typescript/src/enums/syntaxKind.enum.ts index eaf870fa6ea58..1973373f684f3 100644 --- a/packages/typescript/src/enums/syntaxKind.enum.ts +++ b/packages/typescript/src/enums/syntaxKind.enum.ts @@ -168,191 +168,192 @@ export enum SyntaxKind { OverrideKeyword = 164, OfKeyword = 165, DeferKeyword = 166, - QualifiedName = 167, - ComputedPropertyName = 168, - TypeParameter = 169, - Parameter = 170, - Decorator = 171, - PropertySignature = 172, - PropertyDeclaration = 173, - MethodSignature = 174, - MethodDeclaration = 175, - ClassStaticBlockDeclaration = 176, - Constructor = 177, - GetAccessor = 178, - SetAccessor = 179, - CallSignature = 180, - ConstructSignature = 181, - IndexSignature = 182, - TypePredicate = 183, - TypeReference = 184, - FunctionType = 185, - ConstructorType = 186, - TypeQuery = 187, - TypeLiteral = 188, - ArrayType = 189, - TupleType = 190, - OptionalType = 191, - RestType = 192, - UnionType = 193, - IntersectionType = 194, - ConditionalType = 195, - InferType = 196, - ParenthesizedType = 197, - ThisType = 198, - TypeOperator = 199, - IndexedAccessType = 200, - MappedType = 201, - LiteralType = 202, - NamedTupleMember = 203, - TemplateLiteralType = 204, - TemplateLiteralTypeSpan = 205, - ImportType = 206, - ObjectBindingPattern = 207, - ArrayBindingPattern = 208, - BindingElement = 209, - ArrayLiteralExpression = 210, - ObjectLiteralExpression = 211, - PropertyAccessExpression = 212, - ElementAccessExpression = 213, - CallExpression = 214, - NewExpression = 215, - TaggedTemplateExpression = 216, - TypeAssertionExpression = 217, - ParenthesizedExpression = 218, - FunctionExpression = 219, - ArrowFunction = 220, - DeleteExpression = 221, - TypeOfExpression = 222, - VoidExpression = 223, - AwaitExpression = 224, - PrefixUnaryExpression = 225, - PostfixUnaryExpression = 226, - BinaryExpression = 227, - ConditionalExpression = 228, - TemplateExpression = 229, - YieldExpression = 230, - SpreadElement = 231, - ClassExpression = 232, - OmittedExpression = 233, - ExpressionWithTypeArguments = 234, - AsExpression = 235, - NonNullExpression = 236, - MetaProperty = 237, - SyntheticExpression = 238, - SatisfiesExpression = 239, - TemplateSpan = 240, - SemicolonClassElement = 241, - Block = 242, - EmptyStatement = 243, - VariableStatement = 244, - ExpressionStatement = 245, - IfStatement = 246, - DoStatement = 247, - WhileStatement = 248, - ForStatement = 249, - ForInStatement = 250, - ForOfStatement = 251, - ContinueStatement = 252, - BreakStatement = 253, - ReturnStatement = 254, - WithStatement = 255, - SwitchStatement = 256, - LabeledStatement = 257, - ThrowStatement = 258, - TryStatement = 259, - DebuggerStatement = 260, - VariableDeclaration = 261, - VariableDeclarationList = 262, - FunctionDeclaration = 263, - ClassDeclaration = 264, - InterfaceDeclaration = 265, - TypeAliasDeclaration = 266, - EnumDeclaration = 267, - ModuleDeclaration = 268, - ModuleBlock = 269, - CaseBlock = 270, - NamespaceExportDeclaration = 271, - ImportEqualsDeclaration = 272, - ImportDeclaration = 273, - ImportClause = 274, - NamespaceImport = 275, - NamedImports = 276, - ImportSpecifier = 277, - ExportAssignment = 278, - ExportDeclaration = 279, - NamedExports = 280, - NamespaceExport = 281, - ExportSpecifier = 282, - MissingDeclaration = 283, - ExternalModuleReference = 284, - JsxElement = 285, - JsxSelfClosingElement = 286, - JsxOpeningElement = 287, - JsxClosingElement = 288, - JsxFragment = 289, - JsxOpeningFragment = 290, - JsxClosingFragment = 291, - JsxAttribute = 292, - JsxAttributes = 293, - JsxSpreadAttribute = 294, - JsxExpression = 295, - JsxNamespacedName = 296, - CaseClause = 297, - DefaultClause = 298, - HeritageClause = 299, - CatchClause = 300, - ImportAttributes = 301, - ImportAttribute = 302, - PropertyAssignment = 303, - ShorthandPropertyAssignment = 304, - SpreadAssignment = 305, - EnumMember = 306, - SourceFile = 307, - JSDocTypeExpression = 308, - JSDocNameReference = 309, - JSDocAllType = 310, - JSDocNullableType = 311, - JSDocNonNullableType = 312, - JSDocOptionalType = 313, - JSDocVariadicType = 314, - JSDoc = 315, - JSDocText = 316, - JSDocTypeLiteral = 317, - JSDocSignature = 318, - JSDocLink = 319, - JSDocLinkCode = 320, - JSDocLinkPlain = 321, - JSDocUnknownTag = 322, - JSDocAugmentsTag = 323, - JSDocImplementsTag = 324, - JSDocDeprecatedTag = 325, - JSDocPublicTag = 326, - JSDocPrivateTag = 327, - JSDocProtectedTag = 328, - JSDocReadonlyTag = 329, - JSDocOverrideTag = 330, - JSDocCallbackTag = 331, - JSDocOverloadTag = 332, - JSDocParameterTag = 333, - JSDocReturnTag = 334, - JSDocThisTag = 335, - JSDocTypeTag = 336, - JSDocTemplateTag = 337, - JSDocTypedefTag = 338, - JSDocSeeTag = 339, - JSDocPropertyTag = 340, - JSDocThrowsTag = 341, - JSDocSatisfiesTag = 342, - JSDocImportTag = 343, - SyntaxList = 344, - JSTypeAliasDeclaration = 345, - JSImportDeclaration = 346, - NotEmittedStatement = 347, - PartiallyEmittedExpression = 348, - SyntheticReferenceExpression = 349, - NotEmittedTypeElement = 350, - Count = 351, + SourceKeyword = 167, + QualifiedName = 168, + ComputedPropertyName = 169, + TypeParameter = 170, + Parameter = 171, + Decorator = 172, + PropertySignature = 173, + PropertyDeclaration = 174, + MethodSignature = 175, + MethodDeclaration = 176, + ClassStaticBlockDeclaration = 177, + Constructor = 178, + GetAccessor = 179, + SetAccessor = 180, + CallSignature = 181, + ConstructSignature = 182, + IndexSignature = 183, + TypePredicate = 184, + TypeReference = 185, + FunctionType = 186, + ConstructorType = 187, + TypeQuery = 188, + TypeLiteral = 189, + ArrayType = 190, + TupleType = 191, + OptionalType = 192, + RestType = 193, + UnionType = 194, + IntersectionType = 195, + ConditionalType = 196, + InferType = 197, + ParenthesizedType = 198, + ThisType = 199, + TypeOperator = 200, + IndexedAccessType = 201, + MappedType = 202, + LiteralType = 203, + NamedTupleMember = 204, + TemplateLiteralType = 205, + TemplateLiteralTypeSpan = 206, + ImportType = 207, + ObjectBindingPattern = 208, + ArrayBindingPattern = 209, + BindingElement = 210, + ArrayLiteralExpression = 211, + ObjectLiteralExpression = 212, + PropertyAccessExpression = 213, + ElementAccessExpression = 214, + CallExpression = 215, + NewExpression = 216, + TaggedTemplateExpression = 217, + TypeAssertionExpression = 218, + ParenthesizedExpression = 219, + FunctionExpression = 220, + ArrowFunction = 221, + DeleteExpression = 222, + TypeOfExpression = 223, + VoidExpression = 224, + AwaitExpression = 225, + PrefixUnaryExpression = 226, + PostfixUnaryExpression = 227, + BinaryExpression = 228, + ConditionalExpression = 229, + TemplateExpression = 230, + YieldExpression = 231, + SpreadElement = 232, + ClassExpression = 233, + OmittedExpression = 234, + ExpressionWithTypeArguments = 235, + AsExpression = 236, + NonNullExpression = 237, + MetaProperty = 238, + SyntheticExpression = 239, + SatisfiesExpression = 240, + TemplateSpan = 241, + SemicolonClassElement = 242, + Block = 243, + EmptyStatement = 244, + VariableStatement = 245, + ExpressionStatement = 246, + IfStatement = 247, + DoStatement = 248, + WhileStatement = 249, + ForStatement = 250, + ForInStatement = 251, + ForOfStatement = 252, + ContinueStatement = 253, + BreakStatement = 254, + ReturnStatement = 255, + WithStatement = 256, + SwitchStatement = 257, + LabeledStatement = 258, + ThrowStatement = 259, + TryStatement = 260, + DebuggerStatement = 261, + VariableDeclaration = 262, + VariableDeclarationList = 263, + FunctionDeclaration = 264, + ClassDeclaration = 265, + InterfaceDeclaration = 266, + TypeAliasDeclaration = 267, + EnumDeclaration = 268, + ModuleDeclaration = 269, + ModuleBlock = 270, + CaseBlock = 271, + NamespaceExportDeclaration = 272, + ImportEqualsDeclaration = 273, + ImportDeclaration = 274, + ImportClause = 275, + NamespaceImport = 276, + NamedImports = 277, + ImportSpecifier = 278, + ExportAssignment = 279, + ExportDeclaration = 280, + NamedExports = 281, + NamespaceExport = 282, + ExportSpecifier = 283, + MissingDeclaration = 284, + ExternalModuleReference = 285, + JsxElement = 286, + JsxSelfClosingElement = 287, + JsxOpeningElement = 288, + JsxClosingElement = 289, + JsxFragment = 290, + JsxOpeningFragment = 291, + JsxClosingFragment = 292, + JsxAttribute = 293, + JsxAttributes = 294, + JsxSpreadAttribute = 295, + JsxExpression = 296, + JsxNamespacedName = 297, + CaseClause = 298, + DefaultClause = 299, + HeritageClause = 300, + CatchClause = 301, + ImportAttributes = 302, + ImportAttribute = 303, + PropertyAssignment = 304, + ShorthandPropertyAssignment = 305, + SpreadAssignment = 306, + EnumMember = 307, + SourceFile = 308, + JSDocTypeExpression = 309, + JSDocNameReference = 310, + JSDocAllType = 311, + JSDocNullableType = 312, + JSDocNonNullableType = 313, + JSDocOptionalType = 314, + JSDocVariadicType = 315, + JSDoc = 316, + JSDocText = 317, + JSDocTypeLiteral = 318, + JSDocSignature = 319, + JSDocLink = 320, + JSDocLinkCode = 321, + JSDocLinkPlain = 322, + JSDocUnknownTag = 323, + JSDocAugmentsTag = 324, + JSDocImplementsTag = 325, + JSDocDeprecatedTag = 326, + JSDocPublicTag = 327, + JSDocPrivateTag = 328, + JSDocProtectedTag = 329, + JSDocReadonlyTag = 330, + JSDocOverrideTag = 331, + JSDocCallbackTag = 332, + JSDocOverloadTag = 333, + JSDocParameterTag = 334, + JSDocReturnTag = 335, + JSDocThisTag = 336, + JSDocTypeTag = 337, + JSDocTemplateTag = 338, + JSDocTypedefTag = 339, + JSDocSeeTag = 340, + JSDocPropertyTag = 341, + JSDocThrowsTag = 342, + JSDocSatisfiesTag = 343, + JSDocImportTag = 344, + SyntaxList = 345, + JSTypeAliasDeclaration = 346, + JSImportDeclaration = 347, + NotEmittedStatement = 348, + PartiallyEmittedExpression = 349, + SyntheticReferenceExpression = 350, + NotEmittedTypeElement = 351, + Count = 352, FirstAssignment = EqualsToken, LastAssignment = CaretEqualsToken, FirstCompoundAssignment = PlusEqualsToken, @@ -360,7 +361,7 @@ export enum SyntaxKind { FirstReservedWord = BreakKeyword, LastReservedWord = WithKeyword, FirstKeyword = BreakKeyword, - LastKeyword = DeferKeyword, + LastKeyword = SourceKeyword, FirstFutureReservedWord = ImplementsKeyword, LastFutureReservedWord = YieldKeyword, FirstTypeNode = TypePredicate, @@ -383,7 +384,7 @@ export enum SyntaxKind { FirstJSDocTagNode = JSDocUnknownTag, LastJSDocTagNode = JSDocImportTag, FirstContextualKeyword = AbstractKeyword, - LastContextualKeyword = DeferKeyword, + LastContextualKeyword = SourceKeyword, LastUnaryOperator = TildeToken, FirstTriviaToken = SingleLineCommentTrivia, LastTriviaToken = ConflictMarkerTrivia, diff --git a/packages/typescript/src/enums/syntaxKind.ts b/packages/typescript/src/enums/syntaxKind.ts index 534d19efff25c..596eeab49f274 100644 --- a/packages/typescript/src/enums/syntaxKind.ts +++ b/packages/typescript/src/enums/syntaxKind.ts @@ -168,191 +168,192 @@ export var SyntaxKind: any; SyntaxKind[SyntaxKind["OverrideKeyword"] = 164] = "OverrideKeyword"; SyntaxKind[SyntaxKind["OfKeyword"] = 165] = "OfKeyword"; SyntaxKind[SyntaxKind["DeferKeyword"] = 166] = "DeferKeyword"; - SyntaxKind[SyntaxKind["QualifiedName"] = 167] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 168] = "ComputedPropertyName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 169] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 170] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 171] = "Decorator"; - SyntaxKind[SyntaxKind["PropertySignature"] = 172] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 173] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 174] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 175] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 176] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 177] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 178] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 179] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 180] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 181] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 182] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypePredicate"] = 183] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 184] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 185] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 186] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 187] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 188] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 189] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 190] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 191] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 192] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 193] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 194] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 195] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 196] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 197] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 198] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 199] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 200] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 201] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 202] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 203] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 204] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 205] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 206] = "ImportType"; - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 207] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 208] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 209] = "BindingElement"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 210] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 211] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 212] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 213] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 214] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 215] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 216] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 217] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 218] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 219] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 220] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 221] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 222] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 223] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 224] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 225] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 226] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 227] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 228] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 229] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 230] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 231] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 232] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 233] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 234] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 235] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 236] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 237] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 238] = "SyntheticExpression"; - SyntaxKind[SyntaxKind["SatisfiesExpression"] = 239] = "SatisfiesExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 240] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 241] = "SemicolonClassElement"; - SyntaxKind[SyntaxKind["Block"] = 242] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 243] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 244] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 245] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 246] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 247] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 248] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 249] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 250] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 251] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 252] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 253] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 254] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 255] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 256] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 257] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 258] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 259] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 260] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 261] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 262] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 263] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 264] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 265] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 266] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 267] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 268] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 269] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 270] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 271] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 272] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 273] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 274] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 275] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 276] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 277] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 278] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 279] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 280] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 281] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 282] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 283] = "MissingDeclaration"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 284] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["JsxElement"] = 285] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 286] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 287] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 288] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 289] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 290] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 291] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 292] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 293] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 294] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 295] = "JsxExpression"; - SyntaxKind[SyntaxKind["JsxNamespacedName"] = 296] = "JsxNamespacedName"; - SyntaxKind[SyntaxKind["CaseClause"] = 297] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 298] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 299] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 300] = "CatchClause"; - SyntaxKind[SyntaxKind["ImportAttributes"] = 301] = "ImportAttributes"; - SyntaxKind[SyntaxKind["ImportAttribute"] = 302] = "ImportAttribute"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 303] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 304] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 305] = "SpreadAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 306] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 307] = "SourceFile"; - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 308] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 309] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 310] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 311] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 312] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 313] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 314] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDoc"] = 315] = "JSDoc"; - SyntaxKind[SyntaxKind["JSDocText"] = 316] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 317] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 318] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 319] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 320] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 321] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocUnknownTag"] = 322] = "JSDocUnknownTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 323] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 324] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 325] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 326] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 327] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 328] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 329] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 330] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 331] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocOverloadTag"] = 332] = "JSDocOverloadTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 333] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 334] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 335] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 336] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 337] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 338] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 339] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 340] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocThrowsTag"] = 341] = "JSDocThrowsTag"; - SyntaxKind[SyntaxKind["JSDocSatisfiesTag"] = 342] = "JSDocSatisfiesTag"; - SyntaxKind[SyntaxKind["JSDocImportTag"] = 343] = "JSDocImportTag"; - SyntaxKind[SyntaxKind["SyntaxList"] = 344] = "SyntaxList"; - SyntaxKind[SyntaxKind["JSTypeAliasDeclaration"] = 345] = "JSTypeAliasDeclaration"; - SyntaxKind[SyntaxKind["JSImportDeclaration"] = 346] = "JSImportDeclaration"; - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 347] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 348] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 349] = "SyntheticReferenceExpression"; - SyntaxKind[SyntaxKind["NotEmittedTypeElement"] = 350] = "NotEmittedTypeElement"; - SyntaxKind[SyntaxKind["Count"] = 351] = "Count"; + SyntaxKind[SyntaxKind["SourceKeyword"] = 167] = "SourceKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 168] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 169] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 170] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 171] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 172] = "Decorator"; + SyntaxKind[SyntaxKind["PropertySignature"] = 173] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 174] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 175] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 176] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 177] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 178] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 179] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 180] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 181] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 182] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 183] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypePredicate"] = 184] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 185] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 186] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 187] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 188] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 189] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 190] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 191] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 192] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 193] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 194] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 195] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 196] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 197] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 198] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 199] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 200] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 201] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 202] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 203] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 204] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 205] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 206] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 207] = "ImportType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 208] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 209] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 210] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 211] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 212] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 213] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 214] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 215] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 216] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 217] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 218] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 219] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 220] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 221] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 222] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 223] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 224] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 225] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 226] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 227] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 228] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 229] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 230] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 231] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 232] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 233] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 234] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 235] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 236] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 237] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 238] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 239] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 240] = "SatisfiesExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 241] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 242] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["Block"] = 243] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 244] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 245] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 246] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 247] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 248] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 249] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 250] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 251] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 252] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 253] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 254] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 255] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 256] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 257] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 258] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 259] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 260] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 261] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 262] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 263] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 264] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 265] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 266] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 267] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 268] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 269] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 270] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 271] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 272] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 273] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 274] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 275] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 276] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 277] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 278] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 279] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 280] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 281] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 282] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 283] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 284] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 285] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["JsxElement"] = 286] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 287] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 288] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 289] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 290] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 291] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 292] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 293] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 294] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 295] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 296] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxNamespacedName"] = 297] = "JsxNamespacedName"; + SyntaxKind[SyntaxKind["CaseClause"] = 298] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 299] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 300] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 301] = "CatchClause"; + SyntaxKind[SyntaxKind["ImportAttributes"] = 302] = "ImportAttributes"; + SyntaxKind[SyntaxKind["ImportAttribute"] = 303] = "ImportAttribute"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 304] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 305] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 306] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 307] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 311] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 312] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 313] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 314] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 315] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDoc"] = 316] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocText"] = 317] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 318] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 319] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 320] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 321] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 322] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocUnknownTag"] = 323] = "JSDocUnknownTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 324] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 325] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 326] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 327] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 328] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 329] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 330] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 331] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 332] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocOverloadTag"] = 333] = "JSDocOverloadTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 334] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 335] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 336] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 337] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 338] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 339] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 340] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 341] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocThrowsTag"] = 342] = "JSDocThrowsTag"; + SyntaxKind[SyntaxKind["JSDocSatisfiesTag"] = 343] = "JSDocSatisfiesTag"; + SyntaxKind[SyntaxKind["JSDocImportTag"] = 344] = "JSDocImportTag"; + SyntaxKind[SyntaxKind["SyntaxList"] = 345] = "SyntaxList"; + SyntaxKind[SyntaxKind["JSTypeAliasDeclaration"] = 346] = "JSTypeAliasDeclaration"; + SyntaxKind[SyntaxKind["JSImportDeclaration"] = 347] = "JSImportDeclaration"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 348] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 349] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 350] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedTypeElement"] = 351] = "NotEmittedTypeElement"; + SyntaxKind[SyntaxKind["Count"] = 352] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 64] = "FirstCompoundAssignment"; @@ -360,30 +361,30 @@ export var SyntaxKind: any; SyntaxKind[SyntaxKind["FirstReservedWord"] = 82] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 117] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 82] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 166] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 167] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 118] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 126] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 183] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 206] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 184] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 207] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 166] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 167] = "LastToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; SyntaxKind[SyntaxKind["LastLiteralToken"] = 14] = "LastLiteralToken"; SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken"; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 244] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 260] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 167] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 308] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 343] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 322] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 343] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 245] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 261] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 168] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 344] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 323] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 344] = "LastJSDocTagNode"; SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 127] = "FirstContextualKeyword"; - SyntaxKind[SyntaxKind["LastContextualKeyword"] = 166] = "LastContextualKeyword"; + SyntaxKind[SyntaxKind["LastContextualKeyword"] = 167] = "LastContextualKeyword"; SyntaxKind[SyntaxKind["LastUnaryOperator"] = 54] = "LastUnaryOperator"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; diff --git a/packages/typescript/test/async/api.test.ts b/packages/typescript/test/async/api.test.ts index c001884dfaf1c..925ec43a0620a 100644 --- a/packages/typescript/test/async/api.test.ts +++ b/packages/typescript/test/async/api.test.ts @@ -946,6 +946,31 @@ describe("API", { concurrency }, () => { ); }); + test("source imports do not request module resolution", async () => { + await using api = spawnAPI({ + "/src/index.ts": `import source a from "pkg"; +import.source("missing"); +import { value } from "pkg";`, + "/pkg.d.ts": "export const value: number;", + }); + const compilerOptions = { noLib: true, module: ModuleKind.ESNext }; + const requests: string[] = []; + const resolver = await api.createModuleResolver(compilerOptions, { + resolveModuleName: async name => { + requests.push(name); + return { resolvedFileName: "/pkg.d.ts" }; + }, + }); + const program = await api.createProgram(["/src/index.ts"], compilerOptions, { moduleResolver: resolver }); + assert.deepEqual(requests, ["pkg"]); + const file = await program.getSourceFile("/src/index.ts"); + assert.ok(file); + const source = cast(cast(file.statements[0], isImportDeclaration).moduleSpecifier, isStringLiteral); + const evaluation = cast(cast(file.statements[2], isImportDeclaration).moduleSpecifier, isStringLiteral); + assert.equal(await program.getResolvedModuleFromModuleSpecifier(source), undefined); + assert.equal((await program.getResolvedModuleFromModuleSpecifier(evaluation))?.resolvedFileName, "/pkg.d.ts"); + }); + test("module resolver callbacks can delegate to another resolver", async () => { await using api = spawnAPI({ "/src/index.ts": `import "custom"; import "native";`, diff --git a/packages/typescript/test/sync/api.test.ts b/packages/typescript/test/sync/api.test.ts index ccb02ad47c842..68f8fbffbc0ea 100644 --- a/packages/typescript/test/sync/api.test.ts +++ b/packages/typescript/test/sync/api.test.ts @@ -933,6 +933,31 @@ describe("API", { concurrency }, () => { ); }); + test("source imports do not request module resolution", () => { + using api = spawnAPI({ + "/src/index.ts": `import source a from "pkg"; +import.source("missing"); +import { value } from "pkg";`, + "/pkg.d.ts": "export const value: number;", + }); + const compilerOptions = { noLib: true, module: ModuleKind.ESNext }; + const requests: string[] = []; + const resolver = api.createModuleResolver(compilerOptions, { + resolveModuleName: name => { + requests.push(name); + return { resolvedFileName: "/pkg.d.ts" }; + }, + }); + const program = api.createProgram(["/src/index.ts"], compilerOptions, { moduleResolver: resolver }); + assert.deepEqual(requests, ["pkg"]); + const file = program.getSourceFile("/src/index.ts"); + assert.ok(file); + const source = cast(cast(file.statements[0], isImportDeclaration).moduleSpecifier, isStringLiteral); + const evaluation = cast(cast(file.statements[2], isImportDeclaration).moduleSpecifier, isStringLiteral); + assert.equal(program.getResolvedModuleFromModuleSpecifier(source), undefined); + assert.equal((program.getResolvedModuleFromModuleSpecifier(evaluation))?.resolvedFileName, "/pkg.d.ts"); + }); + test("module resolver callbacks can delegate to another resolver", () => { using api = spawnAPI({ "/src/index.ts": `import "custom"; import "native";`, diff --git a/tools/scripts/tsc/ast.json b/tools/scripts/tsc/ast.json index 361aebfb37b88..a133915a10665 100644 --- a/tools/scripts/tsc/ast.json +++ b/tools/scripts/tsc/ast.json @@ -195,8 +195,9 @@ "BigIntKeyword", "OverrideKeyword", "OfKeyword", + "DeferKeyword", { - "name": "DeferKeyword", + "name": "SourceKeyword", "comment": "LastKeyword and LastToken and LastContextualKeyword" }, { @@ -478,7 +479,7 @@ }, { "name": "LastKeyword", - "value": "DeferKeyword" + "value": "SourceKeyword" }, { "name": "FirstFutureReservedWord", @@ -570,7 +571,7 @@ }, { "name": "LastContextualKeyword", - "value": "DeferKeyword" + "value": "SourceKeyword" }, { "name": "LastUnaryOperator", @@ -678,7 +679,8 @@ }, "ImportPhaseModifierSyntaxKind": [ "TypeKeyword", - "DeferKeyword" + "DeferKeyword", + "SourceKeyword" ], "PostfixUnaryOperator": [ "PlusPlusToken", diff --git a/tools/scripts/tsc/options.ts b/tools/scripts/tsc/options.ts index 945dc3eb3cd25..7b1761b3b6239 100644 --- a/tools/scripts/tsc/options.ts +++ b/tools/scripts/tsc/options.ts @@ -2036,6 +2036,7 @@ export const options: OptionsModel = { { name: "esnext.decorators", value: "lib.esnext.decorators.d.ts" }, { name: "esnext.disposable", value: "lib.esnext.disposable.d.ts" }, { name: "esnext.intl", value: "lib.esnext.intl.d.ts" }, + { name: "esnext.modulesource", value: "lib.esnext.modulesource.d.ts" }, { name: "esnext.sharedmemory", value: "lib.esnext.sharedmemory.d.ts" }, { name: "esnext.temporal", value: "lib.esnext.temporal.d.ts" }, { name: "decorators", value: "lib.decorators.d.ts" }, diff --git a/tsc/internal/api/encoder/decoder_generated.go b/tsc/internal/api/encoder/decoder_generated.go index ff5b23cc06f22..612340abfb34c 100644 --- a/tsc/internal/api/encoder/decoder_generated.go +++ b/tsc/internal/api/encoder/decoder_generated.go @@ -210,7 +210,8 @@ func (d *astDecoder) createChildrenNode(kind ast.Kind, data uint32, childIndices ast.KindGlobalKeyword, ast.KindOverrideKeyword, ast.KindOfKeyword, - ast.KindDeferKeyword: + ast.KindDeferKeyword, + ast.KindSourceKeyword: return d.factory.NewToken(kind), nil case ast.KindQualifiedName: it := newChildIter(childIndices) @@ -1095,6 +1096,8 @@ func (d *astDecoder) createChildrenNode(kind ast.Kind, data uint32, childIndices phaseModifier = ast.KindTypeKeyword case 2: phaseModifier = ast.KindDeferKeyword + case 3: + phaseModifier = ast.KindSourceKeyword } it := newChildIter(childIndices) name := d.nodeAt(it.nextIf(mask, 0)) diff --git a/tsc/internal/api/encoder/decoder_test.go b/tsc/internal/api/encoder/decoder_test.go index b7b3c7a52495c..f0cd9786bc19b 100644 --- a/tsc/internal/api/encoder/decoder_test.go +++ b/tsc/internal/api/encoder/decoder_test.go @@ -181,6 +181,20 @@ func TestDecodeSourceFile_ImportDeclaration(t *testing.T) { assert.Equal(t, spec.Name().AsIdentifier().Text, "bar") } +func TestDecodeSourceFile_SourcePhaseImport(t *testing.T) { + t.Parallel() + sf := parseSourceFile(`import source a from "./a.wasm";`) + buf, _, err := encoder.EncodeSourceFile(sf) + assert.NilError(t, err) + + decoded, err := encoder.DecodeSourceFile(buf) + assert.NilError(t, err) + + clause := decoded.Statements.Nodes[0].AsImportDeclaration().ImportClause.AsImportClause() + assert.Equal(t, clause.PhaseModifier, ast.KindSourceKeyword) + assert.Equal(t, clause.Name().Text(), "a") +} + func TestDecodeSourceFile_IfStatement(t *testing.T) { t.Parallel() sf := parseSourceFile("if (true) { } else { }") diff --git a/tsc/internal/api/encoder/encoder_generated.go b/tsc/internal/api/encoder/encoder_generated.go index b4a9021b6cd0b..3f695dabfb03a 100644 --- a/tsc/internal/api/encoder/encoder_generated.go +++ b/tsc/internal/api/encoder/encoder_generated.go @@ -643,6 +643,8 @@ func getNodeCommonData(node *ast.Node) uint32 { phaseModifierIdx = 1 case ast.KindDeferKeyword: phaseModifierIdx = 2 + case ast.KindSourceKeyword: + phaseModifierIdx = 3 } return phaseModifierIdx << 24 case ast.KindImportSpecifier: diff --git a/tsc/internal/api/enum_values_generated.go b/tsc/internal/api/enum_values_generated.go index c08d36f42497e..82896a70cdd76 100644 --- a/tsc/internal/api/enum_values_generated.go +++ b/tsc/internal/api/enum_values_generated.go @@ -497,6 +497,7 @@ func main() { "OverrideKeyword": toInt32(ast.KindOverrideKeyword), "OfKeyword": toInt32(ast.KindOfKeyword), "DeferKeyword": toInt32(ast.KindDeferKeyword), + "SourceKeyword": toInt32(ast.KindSourceKeyword), "QualifiedName": toInt32(ast.KindQualifiedName), "ComputedPropertyName": toInt32(ast.KindComputedPropertyName), "TypeParameter": toInt32(ast.KindTypeParameter), diff --git a/tsc/internal/api/session.go b/tsc/internal/api/session.go index 1ce4c867cb31c..ae7de5c19ea92 100644 --- a/tsc/internal/api/session.go +++ b/tsc/internal/api/session.go @@ -2590,8 +2590,7 @@ func (s *Session) handleGetResolvedModuleFromModuleSpecifier(ctx context.Context if sourceFile == nil { return nil, fmt.Errorf("%w: moduleSpecifier must have a SourceFile ancestor or sourceFile must be provided", ErrClientError) } - mode := program.GetModeForUsageLocation(sourceFile, node) - return newResolvedModuleResponse(program.GetResolvedModule(sourceFile, node.Text(), mode)), nil + return newResolvedModuleResponse(program.GetResolvedModuleFromModuleSpecifier(sourceFile, node)), nil } // @gen-proto-nullable diff --git a/tsc/internal/ast/ast.go b/tsc/internal/ast/ast.go index 019958477f182..f76f15c395862 100644 --- a/tsc/internal/ast/ast.go +++ b/tsc/internal/ast/ast.go @@ -2133,7 +2133,7 @@ func (node *CallExpression) computeSubtreeFacts() SubtreeFacts { propagateSubtreeFacts(node.QuestionDotToken) | propagateEraseableSyntaxListSubtreeFacts(node.TypeArguments) | propagateNodeListSubtreeFacts(node.Arguments, propagateSubtreeFacts) | - core.IfElse(node.Expression.Kind == KindImportKeyword, SubtreeContainsDynamicImport, SubtreeFactsNone) + core.IfElse(IsImportCall(node.AsNode()), SubtreeContainsDynamicImport, SubtreeFactsNone) } func (node *CallExpression) propagateSubtreeFacts() SubtreeFacts { diff --git a/tsc/internal/ast/ast_generated.go b/tsc/internal/ast/ast_generated.go index 44663320bbe2a..f1c27cfe8403e 100644 --- a/tsc/internal/ast/ast_generated.go +++ b/tsc/internal/ast/ast_generated.go @@ -608,7 +608,7 @@ func (node *Token) Clone(f NodeFactoryCoercible) *Node { func IsToken(node *Node) bool { switch node.Kind { - case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindNumericLiteral, KindBigIntLiteral, KindStringLiteral, KindJsxText, KindJsxTextAllWhiteSpaces, KindRegularExpressionLiteral, KindNoSubstitutionTemplateLiteral, KindTemplateHead, KindTemplateMiddle, KindTemplateTail, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindIdentifier, KindPrivateIdentifier, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFalseKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindImportKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindNullKeyword, KindReturnKeyword, KindSuperKeyword, KindSwitchKeyword, KindThisKeyword, KindThrowKeyword, KindTrueKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindVoidKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAnyKeyword, KindAsyncKeyword, KindAwaitKeyword, KindBooleanKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIntrinsicKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindNeverKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindNumberKeyword, KindObjectKeyword, KindSatisfiesKeyword, KindSetKeyword, KindStringKeyword, KindSymbolKeyword, KindTypeKeyword, KindUndefinedKeyword, KindUniqueKeyword, KindUnknownKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindBigIntKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword: + case KindUnknown, KindEndOfFile, KindSingleLineCommentTrivia, KindMultiLineCommentTrivia, KindNewLineTrivia, KindWhitespaceTrivia, KindConflictMarkerTrivia, KindNonTextFileMarkerTrivia, KindNumericLiteral, KindBigIntLiteral, KindStringLiteral, KindJsxText, KindJsxTextAllWhiteSpaces, KindRegularExpressionLiteral, KindNoSubstitutionTemplateLiteral, KindTemplateHead, KindTemplateMiddle, KindTemplateTail, KindOpenBraceToken, KindCloseBraceToken, KindOpenParenToken, KindCloseParenToken, KindOpenBracketToken, KindCloseBracketToken, KindDotToken, KindDotDotDotToken, KindSemicolonToken, KindCommaToken, KindQuestionDotToken, KindLessThanToken, KindLessThanSlashToken, KindGreaterThanToken, KindLessThanEqualsToken, KindGreaterThanEqualsToken, KindEqualsEqualsToken, KindExclamationEqualsToken, KindEqualsEqualsEqualsToken, KindExclamationEqualsEqualsToken, KindEqualsGreaterThanToken, KindPlusToken, KindMinusToken, KindAsteriskToken, KindAsteriskAsteriskToken, KindSlashToken, KindPercentToken, KindPlusPlusToken, KindMinusMinusToken, KindLessThanLessThanToken, KindGreaterThanGreaterThanToken, KindGreaterThanGreaterThanGreaterThanToken, KindAmpersandToken, KindBarToken, KindCaretToken, KindExclamationToken, KindTildeToken, KindAmpersandAmpersandToken, KindBarBarToken, KindQuestionToken, KindColonToken, KindAtToken, KindQuestionQuestionToken, KindBacktickToken, KindHashToken, KindEqualsToken, KindPlusEqualsToken, KindMinusEqualsToken, KindAsteriskEqualsToken, KindAsteriskAsteriskEqualsToken, KindSlashEqualsToken, KindPercentEqualsToken, KindLessThanLessThanEqualsToken, KindGreaterThanGreaterThanEqualsToken, KindGreaterThanGreaterThanGreaterThanEqualsToken, KindAmpersandEqualsToken, KindBarEqualsToken, KindBarBarEqualsToken, KindAmpersandAmpersandEqualsToken, KindQuestionQuestionEqualsToken, KindCaretEqualsToken, KindIdentifier, KindPrivateIdentifier, KindJSDocCommentTextToken, KindBreakKeyword, KindCaseKeyword, KindCatchKeyword, KindClassKeyword, KindConstKeyword, KindContinueKeyword, KindDebuggerKeyword, KindDefaultKeyword, KindDeleteKeyword, KindDoKeyword, KindElseKeyword, KindEnumKeyword, KindExportKeyword, KindExtendsKeyword, KindFalseKeyword, KindFinallyKeyword, KindForKeyword, KindFunctionKeyword, KindIfKeyword, KindImportKeyword, KindInKeyword, KindInstanceOfKeyword, KindNewKeyword, KindNullKeyword, KindReturnKeyword, KindSuperKeyword, KindSwitchKeyword, KindThisKeyword, KindThrowKeyword, KindTrueKeyword, KindTryKeyword, KindTypeOfKeyword, KindVarKeyword, KindVoidKeyword, KindWhileKeyword, KindWithKeyword, KindImplementsKeyword, KindInterfaceKeyword, KindLetKeyword, KindPackageKeyword, KindPrivateKeyword, KindProtectedKeyword, KindPublicKeyword, KindStaticKeyword, KindYieldKeyword, KindAbstractKeyword, KindAccessorKeyword, KindAsKeyword, KindAssertsKeyword, KindAssertKeyword, KindAnyKeyword, KindAsyncKeyword, KindAwaitKeyword, KindBooleanKeyword, KindConstructorKeyword, KindDeclareKeyword, KindGetKeyword, KindImmediateKeyword, KindInferKeyword, KindIntrinsicKeyword, KindIsKeyword, KindKeyOfKeyword, KindModuleKeyword, KindNamespaceKeyword, KindNeverKeyword, KindOutKeyword, KindReadonlyKeyword, KindRequireKeyword, KindNumberKeyword, KindObjectKeyword, KindSatisfiesKeyword, KindSetKeyword, KindStringKeyword, KindSymbolKeyword, KindTypeKeyword, KindUndefinedKeyword, KindUniqueKeyword, KindUnknownKeyword, KindUsingKeyword, KindFromKeyword, KindGlobalKeyword, KindBigIntKeyword, KindOverrideKeyword, KindOfKeyword, KindDeferKeyword, KindSourceKeyword: return true } return false @@ -9877,7 +9877,7 @@ func IsJSDocNodeKind(kind Kind) bool { func IsImportPhaseModifierKind(kind Kind) bool { switch kind { - case KindTypeKeyword, KindDeferKeyword: + case KindTypeKeyword, KindDeferKeyword, KindSourceKeyword: return true } return false diff --git a/tsc/internal/ast/kind_generated.go b/tsc/internal/ast/kind_generated.go index c74eb65e60c18..23f2c9ccf9de6 100644 --- a/tsc/internal/ast/kind_generated.go +++ b/tsc/internal/ast/kind_generated.go @@ -182,7 +182,8 @@ const ( KindBigIntKeyword KindOverrideKeyword KindOfKeyword - KindDeferKeyword // LastKeyword and LastToken and LastContextualKeyword + KindDeferKeyword + KindSourceKeyword // LastKeyword and LastToken and LastContextualKeyword // Parse tree nodes // Names KindQualifiedName @@ -395,7 +396,7 @@ const ( KindFirstReservedWord = KindBreakKeyword KindLastReservedWord = KindWithKeyword KindFirstKeyword = KindBreakKeyword - KindLastKeyword = KindDeferKeyword + KindLastKeyword = KindSourceKeyword KindFirstFutureReservedWord = KindImplementsKeyword KindLastFutureReservedWord = KindYieldKeyword KindFirstTypeNode = KindTypePredicate @@ -418,7 +419,7 @@ const ( KindFirstJSDocTagNode = KindJSDocUnknownTag KindLastJSDocTagNode = KindJSDocImportTag KindFirstContextualKeyword = KindAbstractKeyword - KindLastContextualKeyword = KindDeferKeyword + KindLastContextualKeyword = KindSourceKeyword KindLastUnaryOperator = KindTildeToken KindFirstTriviaToken = KindSingleLineCommentTrivia KindLastTriviaToken = KindConflictMarkerTrivia @@ -429,14 +430,14 @@ type ( LiteralSyntaxKind = Kind // KindNumericLiteral | KindBigIntLiteral | KindStringLiteral | KindJsxText | KindJsxTextAllWhiteSpaces | KindRegularExpressionLiteral | KindNoSubstitutionTemplateLiteral PseudoLiteralSyntaxKind = Kind // KindTemplateHead | KindTemplateMiddle | KindTemplateTail PunctuationSyntaxKind = Kind // KindOpenBraceToken | KindCloseBraceToken | KindOpenParenToken | KindCloseParenToken | KindOpenBracketToken | KindCloseBracketToken | KindDotToken | KindDotDotDotToken | KindSemicolonToken | KindCommaToken | KindQuestionDotToken | KindLessThanToken | KindLessThanSlashToken | KindGreaterThanToken | KindLessThanEqualsToken | KindGreaterThanEqualsToken | KindEqualsEqualsToken | KindExclamationEqualsToken | KindEqualsEqualsEqualsToken | KindExclamationEqualsEqualsToken | KindEqualsGreaterThanToken | KindPlusToken | KindMinusToken | KindAsteriskToken | KindAsteriskAsteriskToken | KindSlashToken | KindPercentToken | KindPlusPlusToken | KindMinusMinusToken | KindLessThanLessThanToken | KindGreaterThanGreaterThanToken | KindGreaterThanGreaterThanGreaterThanToken | KindAmpersandToken | KindBarToken | KindCaretToken | KindExclamationToken | KindTildeToken | KindAmpersandAmpersandToken | KindBarBarToken | KindQuestionToken | KindColonToken | KindAtToken | KindQuestionQuestionToken | KindBacktickToken | KindHashToken | KindEqualsToken | KindPlusEqualsToken | KindMinusEqualsToken | KindAsteriskEqualsToken | KindAsteriskAsteriskEqualsToken | KindSlashEqualsToken | KindPercentEqualsToken | KindLessThanLessThanEqualsToken | KindGreaterThanGreaterThanEqualsToken | KindGreaterThanGreaterThanGreaterThanEqualsToken | KindAmpersandEqualsToken | KindBarEqualsToken | KindBarBarEqualsToken | KindAmpersandAmpersandEqualsToken | KindQuestionQuestionEqualsToken | KindCaretEqualsToken - KeywordSyntaxKind = Kind // KindBreakKeyword | KindCaseKeyword | KindCatchKeyword | KindClassKeyword | KindConstKeyword | KindContinueKeyword | KindDebuggerKeyword | KindDefaultKeyword | KindDeleteKeyword | KindDoKeyword | KindElseKeyword | KindEnumKeyword | KindExportKeyword | KindExtendsKeyword | KindFalseKeyword | KindFinallyKeyword | KindForKeyword | KindFunctionKeyword | KindIfKeyword | KindImportKeyword | KindInKeyword | KindInstanceOfKeyword | KindNewKeyword | KindNullKeyword | KindReturnKeyword | KindSuperKeyword | KindSwitchKeyword | KindThisKeyword | KindThrowKeyword | KindTrueKeyword | KindTryKeyword | KindTypeOfKeyword | KindVarKeyword | KindVoidKeyword | KindWhileKeyword | KindWithKeyword | KindImplementsKeyword | KindInterfaceKeyword | KindLetKeyword | KindPackageKeyword | KindPrivateKeyword | KindProtectedKeyword | KindPublicKeyword | KindStaticKeyword | KindYieldKeyword | KindAbstractKeyword | KindAccessorKeyword | KindAsKeyword | KindAssertsKeyword | KindAssertKeyword | KindAnyKeyword | KindAsyncKeyword | KindAwaitKeyword | KindBooleanKeyword | KindConstructorKeyword | KindDeclareKeyword | KindGetKeyword | KindImmediateKeyword | KindInferKeyword | KindIntrinsicKeyword | KindIsKeyword | KindKeyOfKeyword | KindModuleKeyword | KindNamespaceKeyword | KindNeverKeyword | KindOutKeyword | KindReadonlyKeyword | KindRequireKeyword | KindNumberKeyword | KindObjectKeyword | KindSatisfiesKeyword | KindSetKeyword | KindStringKeyword | KindSymbolKeyword | KindTypeKeyword | KindUndefinedKeyword | KindUniqueKeyword | KindUnknownKeyword | KindUsingKeyword | KindFromKeyword | KindGlobalKeyword | KindBigIntKeyword | KindOverrideKeyword | KindOfKeyword | KindDeferKeyword + KeywordSyntaxKind = Kind // KindBreakKeyword | KindCaseKeyword | KindCatchKeyword | KindClassKeyword | KindConstKeyword | KindContinueKeyword | KindDebuggerKeyword | KindDefaultKeyword | KindDeleteKeyword | KindDoKeyword | KindElseKeyword | KindEnumKeyword | KindExportKeyword | KindExtendsKeyword | KindFalseKeyword | KindFinallyKeyword | KindForKeyword | KindFunctionKeyword | KindIfKeyword | KindImportKeyword | KindInKeyword | KindInstanceOfKeyword | KindNewKeyword | KindNullKeyword | KindReturnKeyword | KindSuperKeyword | KindSwitchKeyword | KindThisKeyword | KindThrowKeyword | KindTrueKeyword | KindTryKeyword | KindTypeOfKeyword | KindVarKeyword | KindVoidKeyword | KindWhileKeyword | KindWithKeyword | KindImplementsKeyword | KindInterfaceKeyword | KindLetKeyword | KindPackageKeyword | KindPrivateKeyword | KindProtectedKeyword | KindPublicKeyword | KindStaticKeyword | KindYieldKeyword | KindAbstractKeyword | KindAccessorKeyword | KindAsKeyword | KindAssertsKeyword | KindAssertKeyword | KindAnyKeyword | KindAsyncKeyword | KindAwaitKeyword | KindBooleanKeyword | KindConstructorKeyword | KindDeclareKeyword | KindGetKeyword | KindImmediateKeyword | KindInferKeyword | KindIntrinsicKeyword | KindIsKeyword | KindKeyOfKeyword | KindModuleKeyword | KindNamespaceKeyword | KindNeverKeyword | KindOutKeyword | KindReadonlyKeyword | KindRequireKeyword | KindNumberKeyword | KindObjectKeyword | KindSatisfiesKeyword | KindSetKeyword | KindStringKeyword | KindSymbolKeyword | KindTypeKeyword | KindUndefinedKeyword | KindUniqueKeyword | KindUnknownKeyword | KindUsingKeyword | KindFromKeyword | KindGlobalKeyword | KindBigIntKeyword | KindOverrideKeyword | KindOfKeyword | KindDeferKeyword | KindSourceKeyword ModifierSyntaxKind = Kind // KindAbstractKeyword | KindAccessorKeyword | KindAsyncKeyword | KindConstKeyword | KindDeclareKeyword | KindDefaultKeyword | KindExportKeyword | KindInKeyword | KindPrivateKeyword | KindProtectedKeyword | KindPublicKeyword | KindReadonlyKeyword | KindOutKeyword | KindOverrideKeyword | KindStaticKeyword KeywordTypeSyntaxKind = Kind // KindAnyKeyword | KindBigIntKeyword | KindBooleanKeyword | KindIntrinsicKeyword | KindNeverKeyword | KindNumberKeyword | KindObjectKeyword | KindStringKeyword | KindSymbolKeyword | KindUndefinedKeyword | KindUnknownKeyword | KindVoidKeyword KeywordExpressionSyntaxKind = Kind // KindNullKeyword | KindTrueKeyword | KindFalseKeyword | KindThisKeyword | KindSuperKeyword | KindImportKeyword - TokenSyntaxKind = Kind // KindUnknown | KindEndOfFile | KindSingleLineCommentTrivia | KindMultiLineCommentTrivia | KindNewLineTrivia | KindWhitespaceTrivia | KindConflictMarkerTrivia | KindNonTextFileMarkerTrivia | KindNumericLiteral | KindBigIntLiteral | KindStringLiteral | KindJsxText | KindJsxTextAllWhiteSpaces | KindRegularExpressionLiteral | KindNoSubstitutionTemplateLiteral | KindTemplateHead | KindTemplateMiddle | KindTemplateTail | KindOpenBraceToken | KindCloseBraceToken | KindOpenParenToken | KindCloseParenToken | KindOpenBracketToken | KindCloseBracketToken | KindDotToken | KindDotDotDotToken | KindSemicolonToken | KindCommaToken | KindQuestionDotToken | KindLessThanToken | KindLessThanSlashToken | KindGreaterThanToken | KindLessThanEqualsToken | KindGreaterThanEqualsToken | KindEqualsEqualsToken | KindExclamationEqualsToken | KindEqualsEqualsEqualsToken | KindExclamationEqualsEqualsToken | KindEqualsGreaterThanToken | KindPlusToken | KindMinusToken | KindAsteriskToken | KindAsteriskAsteriskToken | KindSlashToken | KindPercentToken | KindPlusPlusToken | KindMinusMinusToken | KindLessThanLessThanToken | KindGreaterThanGreaterThanToken | KindGreaterThanGreaterThanGreaterThanToken | KindAmpersandToken | KindBarToken | KindCaretToken | KindExclamationToken | KindTildeToken | KindAmpersandAmpersandToken | KindBarBarToken | KindQuestionToken | KindColonToken | KindAtToken | KindQuestionQuestionToken | KindBacktickToken | KindHashToken | KindEqualsToken | KindPlusEqualsToken | KindMinusEqualsToken | KindAsteriskEqualsToken | KindAsteriskAsteriskEqualsToken | KindSlashEqualsToken | KindPercentEqualsToken | KindLessThanLessThanEqualsToken | KindGreaterThanGreaterThanEqualsToken | KindGreaterThanGreaterThanGreaterThanEqualsToken | KindAmpersandEqualsToken | KindBarEqualsToken | KindBarBarEqualsToken | KindAmpersandAmpersandEqualsToken | KindQuestionQuestionEqualsToken | KindCaretEqualsToken | KindIdentifier | KindPrivateIdentifier | KindJSDocCommentTextToken | KindBreakKeyword | KindCaseKeyword | KindCatchKeyword | KindClassKeyword | KindConstKeyword | KindContinueKeyword | KindDebuggerKeyword | KindDefaultKeyword | KindDeleteKeyword | KindDoKeyword | KindElseKeyword | KindEnumKeyword | KindExportKeyword | KindExtendsKeyword | KindFalseKeyword | KindFinallyKeyword | KindForKeyword | KindFunctionKeyword | KindIfKeyword | KindImportKeyword | KindInKeyword | KindInstanceOfKeyword | KindNewKeyword | KindNullKeyword | KindReturnKeyword | KindSuperKeyword | KindSwitchKeyword | KindThisKeyword | KindThrowKeyword | KindTrueKeyword | KindTryKeyword | KindTypeOfKeyword | KindVarKeyword | KindVoidKeyword | KindWhileKeyword | KindWithKeyword | KindImplementsKeyword | KindInterfaceKeyword | KindLetKeyword | KindPackageKeyword | KindPrivateKeyword | KindProtectedKeyword | KindPublicKeyword | KindStaticKeyword | KindYieldKeyword | KindAbstractKeyword | KindAccessorKeyword | KindAsKeyword | KindAssertsKeyword | KindAssertKeyword | KindAnyKeyword | KindAsyncKeyword | KindAwaitKeyword | KindBooleanKeyword | KindConstructorKeyword | KindDeclareKeyword | KindGetKeyword | KindImmediateKeyword | KindInferKeyword | KindIntrinsicKeyword | KindIsKeyword | KindKeyOfKeyword | KindModuleKeyword | KindNamespaceKeyword | KindNeverKeyword | KindOutKeyword | KindReadonlyKeyword | KindRequireKeyword | KindNumberKeyword | KindObjectKeyword | KindSatisfiesKeyword | KindSetKeyword | KindStringKeyword | KindSymbolKeyword | KindTypeKeyword | KindUndefinedKeyword | KindUniqueKeyword | KindUnknownKeyword | KindUsingKeyword | KindFromKeyword | KindGlobalKeyword | KindBigIntKeyword | KindOverrideKeyword | KindOfKeyword | KindDeferKeyword + TokenSyntaxKind = Kind // KindUnknown | KindEndOfFile | KindSingleLineCommentTrivia | KindMultiLineCommentTrivia | KindNewLineTrivia | KindWhitespaceTrivia | KindConflictMarkerTrivia | KindNonTextFileMarkerTrivia | KindNumericLiteral | KindBigIntLiteral | KindStringLiteral | KindJsxText | KindJsxTextAllWhiteSpaces | KindRegularExpressionLiteral | KindNoSubstitutionTemplateLiteral | KindTemplateHead | KindTemplateMiddle | KindTemplateTail | KindOpenBraceToken | KindCloseBraceToken | KindOpenParenToken | KindCloseParenToken | KindOpenBracketToken | KindCloseBracketToken | KindDotToken | KindDotDotDotToken | KindSemicolonToken | KindCommaToken | KindQuestionDotToken | KindLessThanToken | KindLessThanSlashToken | KindGreaterThanToken | KindLessThanEqualsToken | KindGreaterThanEqualsToken | KindEqualsEqualsToken | KindExclamationEqualsToken | KindEqualsEqualsEqualsToken | KindExclamationEqualsEqualsToken | KindEqualsGreaterThanToken | KindPlusToken | KindMinusToken | KindAsteriskToken | KindAsteriskAsteriskToken | KindSlashToken | KindPercentToken | KindPlusPlusToken | KindMinusMinusToken | KindLessThanLessThanToken | KindGreaterThanGreaterThanToken | KindGreaterThanGreaterThanGreaterThanToken | KindAmpersandToken | KindBarToken | KindCaretToken | KindExclamationToken | KindTildeToken | KindAmpersandAmpersandToken | KindBarBarToken | KindQuestionToken | KindColonToken | KindAtToken | KindQuestionQuestionToken | KindBacktickToken | KindHashToken | KindEqualsToken | KindPlusEqualsToken | KindMinusEqualsToken | KindAsteriskEqualsToken | KindAsteriskAsteriskEqualsToken | KindSlashEqualsToken | KindPercentEqualsToken | KindLessThanLessThanEqualsToken | KindGreaterThanGreaterThanEqualsToken | KindGreaterThanGreaterThanGreaterThanEqualsToken | KindAmpersandEqualsToken | KindBarEqualsToken | KindBarBarEqualsToken | KindAmpersandAmpersandEqualsToken | KindQuestionQuestionEqualsToken | KindCaretEqualsToken | KindIdentifier | KindPrivateIdentifier | KindJSDocCommentTextToken | KindBreakKeyword | KindCaseKeyword | KindCatchKeyword | KindClassKeyword | KindConstKeyword | KindContinueKeyword | KindDebuggerKeyword | KindDefaultKeyword | KindDeleteKeyword | KindDoKeyword | KindElseKeyword | KindEnumKeyword | KindExportKeyword | KindExtendsKeyword | KindFalseKeyword | KindFinallyKeyword | KindForKeyword | KindFunctionKeyword | KindIfKeyword | KindImportKeyword | KindInKeyword | KindInstanceOfKeyword | KindNewKeyword | KindNullKeyword | KindReturnKeyword | KindSuperKeyword | KindSwitchKeyword | KindThisKeyword | KindThrowKeyword | KindTrueKeyword | KindTryKeyword | KindTypeOfKeyword | KindVarKeyword | KindVoidKeyword | KindWhileKeyword | KindWithKeyword | KindImplementsKeyword | KindInterfaceKeyword | KindLetKeyword | KindPackageKeyword | KindPrivateKeyword | KindProtectedKeyword | KindPublicKeyword | KindStaticKeyword | KindYieldKeyword | KindAbstractKeyword | KindAccessorKeyword | KindAsKeyword | KindAssertsKeyword | KindAssertKeyword | KindAnyKeyword | KindAsyncKeyword | KindAwaitKeyword | KindBooleanKeyword | KindConstructorKeyword | KindDeclareKeyword | KindGetKeyword | KindImmediateKeyword | KindInferKeyword | KindIntrinsicKeyword | KindIsKeyword | KindKeyOfKeyword | KindModuleKeyword | KindNamespaceKeyword | KindNeverKeyword | KindOutKeyword | KindReadonlyKeyword | KindRequireKeyword | KindNumberKeyword | KindObjectKeyword | KindSatisfiesKeyword | KindSetKeyword | KindStringKeyword | KindSymbolKeyword | KindTypeKeyword | KindUndefinedKeyword | KindUniqueKeyword | KindUnknownKeyword | KindUsingKeyword | KindFromKeyword | KindGlobalKeyword | KindBigIntKeyword | KindOverrideKeyword | KindOfKeyword | KindDeferKeyword | KindSourceKeyword JsxTokenSyntaxKind = Kind // KindLessThanSlashToken | KindEndOfFile | KindConflictMarkerTrivia | KindJsxText | KindJsxTextAllWhiteSpaces | KindOpenBraceToken | KindLessThanToken JSDocNodeSyntaxKind = Kind // KindJSDocTypeExpression | KindJSDocNameReference | KindJSDocAllType | KindJSDocNullableType | KindJSDocNonNullableType | KindJSDocOptionalType | KindJSDocVariadicType | KindJSDoc | KindJSDocText | KindJSDocTypeLiteral | KindJSDocSignature | KindJSDocLink | KindJSDocLinkCode | KindJSDocLinkPlain | KindJSDocUnknownTag | KindJSDocAugmentsTag | KindJSDocImplementsTag | KindJSDocDeprecatedTag | KindJSDocPublicTag | KindJSDocPrivateTag | KindJSDocProtectedTag | KindJSDocReadonlyTag | KindJSDocOverrideTag | KindJSDocCallbackTag | KindJSDocOverloadTag | KindJSDocParameterTag | KindJSDocReturnTag | KindJSDocThisTag | KindJSDocTypeTag | KindJSDocTemplateTag | KindJSDocTypedefTag | KindJSDocSeeTag | KindJSDocPropertyTag | KindJSDocThrowsTag | KindJSDocSatisfiesTag | KindJSDocImportTag - ImportPhaseModifierSyntaxKind = Kind // KindTypeKeyword | KindDeferKeyword + ImportPhaseModifierSyntaxKind = Kind // KindTypeKeyword | KindDeferKeyword | KindSourceKeyword PostfixUnaryOperator = Kind // KindPlusPlusToken | KindMinusMinusToken PrefixUnaryOperator = Kind // KindPlusToken | KindMinusToken | KindTildeToken | KindExclamationToken | KindPlusPlusToken | KindMinusMinusToken AssignmentOperator = Kind // KindEqualsToken | KindPlusEqualsToken | KindMinusEqualsToken | KindAsteriskAsteriskEqualsToken | KindAsteriskEqualsToken | KindSlashEqualsToken | KindPercentEqualsToken | KindAmpersandEqualsToken | KindBarEqualsToken | KindCaretEqualsToken | KindLessThanLessThanEqualsToken | KindGreaterThanGreaterThanGreaterThanEqualsToken | KindGreaterThanGreaterThanEqualsToken | KindBarBarEqualsToken | KindAmpersandAmpersandEqualsToken | KindQuestionQuestionEqualsToken diff --git a/tsc/internal/ast/kind_stringer_generated.go b/tsc/internal/ast/kind_stringer_generated.go index b80f1ba531982..9600c3d090453 100644 --- a/tsc/internal/ast/kind_stringer_generated.go +++ b/tsc/internal/ast/kind_stringer_generated.go @@ -175,196 +175,197 @@ func _() { _ = x[KindOverrideKeyword-164] _ = x[KindOfKeyword-165] _ = x[KindDeferKeyword-166] - _ = x[KindQualifiedName-167] - _ = x[KindComputedPropertyName-168] - _ = x[KindTypeParameter-169] - _ = x[KindParameter-170] - _ = x[KindDecorator-171] - _ = x[KindPropertySignature-172] - _ = x[KindPropertyDeclaration-173] - _ = x[KindMethodSignature-174] - _ = x[KindMethodDeclaration-175] - _ = x[KindClassStaticBlockDeclaration-176] - _ = x[KindConstructor-177] - _ = x[KindGetAccessor-178] - _ = x[KindSetAccessor-179] - _ = x[KindCallSignature-180] - _ = x[KindConstructSignature-181] - _ = x[KindIndexSignature-182] - _ = x[KindTypePredicate-183] - _ = x[KindTypeReference-184] - _ = x[KindFunctionType-185] - _ = x[KindConstructorType-186] - _ = x[KindTypeQuery-187] - _ = x[KindTypeLiteral-188] - _ = x[KindArrayType-189] - _ = x[KindTupleType-190] - _ = x[KindOptionalType-191] - _ = x[KindRestType-192] - _ = x[KindUnionType-193] - _ = x[KindIntersectionType-194] - _ = x[KindConditionalType-195] - _ = x[KindInferType-196] - _ = x[KindParenthesizedType-197] - _ = x[KindThisType-198] - _ = x[KindTypeOperator-199] - _ = x[KindIndexedAccessType-200] - _ = x[KindMappedType-201] - _ = x[KindLiteralType-202] - _ = x[KindNamedTupleMember-203] - _ = x[KindTemplateLiteralType-204] - _ = x[KindTemplateLiteralTypeSpan-205] - _ = x[KindImportType-206] - _ = x[KindObjectBindingPattern-207] - _ = x[KindArrayBindingPattern-208] - _ = x[KindBindingElement-209] - _ = x[KindArrayLiteralExpression-210] - _ = x[KindObjectLiteralExpression-211] - _ = x[KindPropertyAccessExpression-212] - _ = x[KindElementAccessExpression-213] - _ = x[KindCallExpression-214] - _ = x[KindNewExpression-215] - _ = x[KindTaggedTemplateExpression-216] - _ = x[KindTypeAssertionExpression-217] - _ = x[KindParenthesizedExpression-218] - _ = x[KindFunctionExpression-219] - _ = x[KindArrowFunction-220] - _ = x[KindDeleteExpression-221] - _ = x[KindTypeOfExpression-222] - _ = x[KindVoidExpression-223] - _ = x[KindAwaitExpression-224] - _ = x[KindPrefixUnaryExpression-225] - _ = x[KindPostfixUnaryExpression-226] - _ = x[KindBinaryExpression-227] - _ = x[KindConditionalExpression-228] - _ = x[KindTemplateExpression-229] - _ = x[KindYieldExpression-230] - _ = x[KindSpreadElement-231] - _ = x[KindClassExpression-232] - _ = x[KindOmittedExpression-233] - _ = x[KindExpressionWithTypeArguments-234] - _ = x[KindAsExpression-235] - _ = x[KindNonNullExpression-236] - _ = x[KindMetaProperty-237] - _ = x[KindSyntheticExpression-238] - _ = x[KindSatisfiesExpression-239] - _ = x[KindTemplateSpan-240] - _ = x[KindSemicolonClassElement-241] - _ = x[KindBlock-242] - _ = x[KindEmptyStatement-243] - _ = x[KindVariableStatement-244] - _ = x[KindExpressionStatement-245] - _ = x[KindIfStatement-246] - _ = x[KindDoStatement-247] - _ = x[KindWhileStatement-248] - _ = x[KindForStatement-249] - _ = x[KindForInStatement-250] - _ = x[KindForOfStatement-251] - _ = x[KindContinueStatement-252] - _ = x[KindBreakStatement-253] - _ = x[KindReturnStatement-254] - _ = x[KindWithStatement-255] - _ = x[KindSwitchStatement-256] - _ = x[KindLabeledStatement-257] - _ = x[KindThrowStatement-258] - _ = x[KindTryStatement-259] - _ = x[KindDebuggerStatement-260] - _ = x[KindVariableDeclaration-261] - _ = x[KindVariableDeclarationList-262] - _ = x[KindFunctionDeclaration-263] - _ = x[KindClassDeclaration-264] - _ = x[KindInterfaceDeclaration-265] - _ = x[KindTypeAliasDeclaration-266] - _ = x[KindEnumDeclaration-267] - _ = x[KindModuleDeclaration-268] - _ = x[KindModuleBlock-269] - _ = x[KindCaseBlock-270] - _ = x[KindNamespaceExportDeclaration-271] - _ = x[KindImportEqualsDeclaration-272] - _ = x[KindImportDeclaration-273] - _ = x[KindImportClause-274] - _ = x[KindNamespaceImport-275] - _ = x[KindNamedImports-276] - _ = x[KindImportSpecifier-277] - _ = x[KindExportAssignment-278] - _ = x[KindExportDeclaration-279] - _ = x[KindNamedExports-280] - _ = x[KindNamespaceExport-281] - _ = x[KindExportSpecifier-282] - _ = x[KindMissingDeclaration-283] - _ = x[KindExternalModuleReference-284] - _ = x[KindJsxElement-285] - _ = x[KindJsxSelfClosingElement-286] - _ = x[KindJsxOpeningElement-287] - _ = x[KindJsxClosingElement-288] - _ = x[KindJsxFragment-289] - _ = x[KindJsxOpeningFragment-290] - _ = x[KindJsxClosingFragment-291] - _ = x[KindJsxAttribute-292] - _ = x[KindJsxAttributes-293] - _ = x[KindJsxSpreadAttribute-294] - _ = x[KindJsxExpression-295] - _ = x[KindJsxNamespacedName-296] - _ = x[KindCaseClause-297] - _ = x[KindDefaultClause-298] - _ = x[KindHeritageClause-299] - _ = x[KindCatchClause-300] - _ = x[KindImportAttributes-301] - _ = x[KindImportAttribute-302] - _ = x[KindPropertyAssignment-303] - _ = x[KindShorthandPropertyAssignment-304] - _ = x[KindSpreadAssignment-305] - _ = x[KindEnumMember-306] - _ = x[KindSourceFile-307] - _ = x[KindJSDocTypeExpression-308] - _ = x[KindJSDocNameReference-309] - _ = x[KindJSDocAllType-310] - _ = x[KindJSDocNullableType-311] - _ = x[KindJSDocNonNullableType-312] - _ = x[KindJSDocOptionalType-313] - _ = x[KindJSDocVariadicType-314] - _ = x[KindJSDoc-315] - _ = x[KindJSDocText-316] - _ = x[KindJSDocTypeLiteral-317] - _ = x[KindJSDocSignature-318] - _ = x[KindJSDocLink-319] - _ = x[KindJSDocLinkCode-320] - _ = x[KindJSDocLinkPlain-321] - _ = x[KindJSDocUnknownTag-322] - _ = x[KindJSDocAugmentsTag-323] - _ = x[KindJSDocImplementsTag-324] - _ = x[KindJSDocDeprecatedTag-325] - _ = x[KindJSDocPublicTag-326] - _ = x[KindJSDocPrivateTag-327] - _ = x[KindJSDocProtectedTag-328] - _ = x[KindJSDocReadonlyTag-329] - _ = x[KindJSDocOverrideTag-330] - _ = x[KindJSDocCallbackTag-331] - _ = x[KindJSDocOverloadTag-332] - _ = x[KindJSDocParameterTag-333] - _ = x[KindJSDocReturnTag-334] - _ = x[KindJSDocThisTag-335] - _ = x[KindJSDocTypeTag-336] - _ = x[KindJSDocTemplateTag-337] - _ = x[KindJSDocTypedefTag-338] - _ = x[KindJSDocSeeTag-339] - _ = x[KindJSDocPropertyTag-340] - _ = x[KindJSDocThrowsTag-341] - _ = x[KindJSDocSatisfiesTag-342] - _ = x[KindJSDocImportTag-343] - _ = x[KindSyntaxList-344] - _ = x[KindJSTypeAliasDeclaration-345] - _ = x[KindJSImportDeclaration-346] - _ = x[KindNotEmittedStatement-347] - _ = x[KindPartiallyEmittedExpression-348] - _ = x[KindSyntheticReferenceExpression-349] - _ = x[KindNotEmittedTypeElement-350] - _ = x[KindCount-351] + _ = x[KindSourceKeyword-167] + _ = x[KindQualifiedName-168] + _ = x[KindComputedPropertyName-169] + _ = x[KindTypeParameter-170] + _ = x[KindParameter-171] + _ = x[KindDecorator-172] + _ = x[KindPropertySignature-173] + _ = x[KindPropertyDeclaration-174] + _ = x[KindMethodSignature-175] + _ = x[KindMethodDeclaration-176] + _ = x[KindClassStaticBlockDeclaration-177] + _ = x[KindConstructor-178] + _ = x[KindGetAccessor-179] + _ = x[KindSetAccessor-180] + _ = x[KindCallSignature-181] + _ = x[KindConstructSignature-182] + _ = x[KindIndexSignature-183] + _ = x[KindTypePredicate-184] + _ = x[KindTypeReference-185] + _ = x[KindFunctionType-186] + _ = x[KindConstructorType-187] + _ = x[KindTypeQuery-188] + _ = x[KindTypeLiteral-189] + _ = x[KindArrayType-190] + _ = x[KindTupleType-191] + _ = x[KindOptionalType-192] + _ = x[KindRestType-193] + _ = x[KindUnionType-194] + _ = x[KindIntersectionType-195] + _ = x[KindConditionalType-196] + _ = x[KindInferType-197] + _ = x[KindParenthesizedType-198] + _ = x[KindThisType-199] + _ = x[KindTypeOperator-200] + _ = x[KindIndexedAccessType-201] + _ = x[KindMappedType-202] + _ = x[KindLiteralType-203] + _ = x[KindNamedTupleMember-204] + _ = x[KindTemplateLiteralType-205] + _ = x[KindTemplateLiteralTypeSpan-206] + _ = x[KindImportType-207] + _ = x[KindObjectBindingPattern-208] + _ = x[KindArrayBindingPattern-209] + _ = x[KindBindingElement-210] + _ = x[KindArrayLiteralExpression-211] + _ = x[KindObjectLiteralExpression-212] + _ = x[KindPropertyAccessExpression-213] + _ = x[KindElementAccessExpression-214] + _ = x[KindCallExpression-215] + _ = x[KindNewExpression-216] + _ = x[KindTaggedTemplateExpression-217] + _ = x[KindTypeAssertionExpression-218] + _ = x[KindParenthesizedExpression-219] + _ = x[KindFunctionExpression-220] + _ = x[KindArrowFunction-221] + _ = x[KindDeleteExpression-222] + _ = x[KindTypeOfExpression-223] + _ = x[KindVoidExpression-224] + _ = x[KindAwaitExpression-225] + _ = x[KindPrefixUnaryExpression-226] + _ = x[KindPostfixUnaryExpression-227] + _ = x[KindBinaryExpression-228] + _ = x[KindConditionalExpression-229] + _ = x[KindTemplateExpression-230] + _ = x[KindYieldExpression-231] + _ = x[KindSpreadElement-232] + _ = x[KindClassExpression-233] + _ = x[KindOmittedExpression-234] + _ = x[KindExpressionWithTypeArguments-235] + _ = x[KindAsExpression-236] + _ = x[KindNonNullExpression-237] + _ = x[KindMetaProperty-238] + _ = x[KindSyntheticExpression-239] + _ = x[KindSatisfiesExpression-240] + _ = x[KindTemplateSpan-241] + _ = x[KindSemicolonClassElement-242] + _ = x[KindBlock-243] + _ = x[KindEmptyStatement-244] + _ = x[KindVariableStatement-245] + _ = x[KindExpressionStatement-246] + _ = x[KindIfStatement-247] + _ = x[KindDoStatement-248] + _ = x[KindWhileStatement-249] + _ = x[KindForStatement-250] + _ = x[KindForInStatement-251] + _ = x[KindForOfStatement-252] + _ = x[KindContinueStatement-253] + _ = x[KindBreakStatement-254] + _ = x[KindReturnStatement-255] + _ = x[KindWithStatement-256] + _ = x[KindSwitchStatement-257] + _ = x[KindLabeledStatement-258] + _ = x[KindThrowStatement-259] + _ = x[KindTryStatement-260] + _ = x[KindDebuggerStatement-261] + _ = x[KindVariableDeclaration-262] + _ = x[KindVariableDeclarationList-263] + _ = x[KindFunctionDeclaration-264] + _ = x[KindClassDeclaration-265] + _ = x[KindInterfaceDeclaration-266] + _ = x[KindTypeAliasDeclaration-267] + _ = x[KindEnumDeclaration-268] + _ = x[KindModuleDeclaration-269] + _ = x[KindModuleBlock-270] + _ = x[KindCaseBlock-271] + _ = x[KindNamespaceExportDeclaration-272] + _ = x[KindImportEqualsDeclaration-273] + _ = x[KindImportDeclaration-274] + _ = x[KindImportClause-275] + _ = x[KindNamespaceImport-276] + _ = x[KindNamedImports-277] + _ = x[KindImportSpecifier-278] + _ = x[KindExportAssignment-279] + _ = x[KindExportDeclaration-280] + _ = x[KindNamedExports-281] + _ = x[KindNamespaceExport-282] + _ = x[KindExportSpecifier-283] + _ = x[KindMissingDeclaration-284] + _ = x[KindExternalModuleReference-285] + _ = x[KindJsxElement-286] + _ = x[KindJsxSelfClosingElement-287] + _ = x[KindJsxOpeningElement-288] + _ = x[KindJsxClosingElement-289] + _ = x[KindJsxFragment-290] + _ = x[KindJsxOpeningFragment-291] + _ = x[KindJsxClosingFragment-292] + _ = x[KindJsxAttribute-293] + _ = x[KindJsxAttributes-294] + _ = x[KindJsxSpreadAttribute-295] + _ = x[KindJsxExpression-296] + _ = x[KindJsxNamespacedName-297] + _ = x[KindCaseClause-298] + _ = x[KindDefaultClause-299] + _ = x[KindHeritageClause-300] + _ = x[KindCatchClause-301] + _ = x[KindImportAttributes-302] + _ = x[KindImportAttribute-303] + _ = x[KindPropertyAssignment-304] + _ = x[KindShorthandPropertyAssignment-305] + _ = x[KindSpreadAssignment-306] + _ = x[KindEnumMember-307] + _ = x[KindSourceFile-308] + _ = x[KindJSDocTypeExpression-309] + _ = x[KindJSDocNameReference-310] + _ = x[KindJSDocAllType-311] + _ = x[KindJSDocNullableType-312] + _ = x[KindJSDocNonNullableType-313] + _ = x[KindJSDocOptionalType-314] + _ = x[KindJSDocVariadicType-315] + _ = x[KindJSDoc-316] + _ = x[KindJSDocText-317] + _ = x[KindJSDocTypeLiteral-318] + _ = x[KindJSDocSignature-319] + _ = x[KindJSDocLink-320] + _ = x[KindJSDocLinkCode-321] + _ = x[KindJSDocLinkPlain-322] + _ = x[KindJSDocUnknownTag-323] + _ = x[KindJSDocAugmentsTag-324] + _ = x[KindJSDocImplementsTag-325] + _ = x[KindJSDocDeprecatedTag-326] + _ = x[KindJSDocPublicTag-327] + _ = x[KindJSDocPrivateTag-328] + _ = x[KindJSDocProtectedTag-329] + _ = x[KindJSDocReadonlyTag-330] + _ = x[KindJSDocOverrideTag-331] + _ = x[KindJSDocCallbackTag-332] + _ = x[KindJSDocOverloadTag-333] + _ = x[KindJSDocParameterTag-334] + _ = x[KindJSDocReturnTag-335] + _ = x[KindJSDocThisTag-336] + _ = x[KindJSDocTypeTag-337] + _ = x[KindJSDocTemplateTag-338] + _ = x[KindJSDocTypedefTag-339] + _ = x[KindJSDocSeeTag-340] + _ = x[KindJSDocPropertyTag-341] + _ = x[KindJSDocThrowsTag-342] + _ = x[KindJSDocSatisfiesTag-343] + _ = x[KindJSDocImportTag-344] + _ = x[KindSyntaxList-345] + _ = x[KindJSTypeAliasDeclaration-346] + _ = x[KindJSImportDeclaration-347] + _ = x[KindNotEmittedStatement-348] + _ = x[KindPartiallyEmittedExpression-349] + _ = x[KindSyntheticReferenceExpression-350] + _ = x[KindNotEmittedTypeElement-351] + _ = x[KindCount-352] } -const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindDeferKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocUnknownTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocThrowsTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSImportDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindSyntheticReferenceExpressionKindNotEmittedTypeElementKindCount" +const _Kind_name = "KindUnknownKindEndOfFileKindSingleLineCommentTriviaKindMultiLineCommentTriviaKindNewLineTriviaKindWhitespaceTriviaKindConflictMarkerTriviaKindNonTextFileMarkerTriviaKindNumericLiteralKindBigIntLiteralKindStringLiteralKindJsxTextKindJsxTextAllWhiteSpacesKindRegularExpressionLiteralKindNoSubstitutionTemplateLiteralKindTemplateHeadKindTemplateMiddleKindTemplateTailKindOpenBraceTokenKindCloseBraceTokenKindOpenParenTokenKindCloseParenTokenKindOpenBracketTokenKindCloseBracketTokenKindDotTokenKindDotDotDotTokenKindSemicolonTokenKindCommaTokenKindQuestionDotTokenKindLessThanTokenKindLessThanSlashTokenKindGreaterThanTokenKindLessThanEqualsTokenKindGreaterThanEqualsTokenKindEqualsEqualsTokenKindExclamationEqualsTokenKindEqualsEqualsEqualsTokenKindExclamationEqualsEqualsTokenKindEqualsGreaterThanTokenKindPlusTokenKindMinusTokenKindAsteriskTokenKindAsteriskAsteriskTokenKindSlashTokenKindPercentTokenKindPlusPlusTokenKindMinusMinusTokenKindLessThanLessThanTokenKindGreaterThanGreaterThanTokenKindGreaterThanGreaterThanGreaterThanTokenKindAmpersandTokenKindBarTokenKindCaretTokenKindExclamationTokenKindTildeTokenKindAmpersandAmpersandTokenKindBarBarTokenKindQuestionTokenKindColonTokenKindAtTokenKindQuestionQuestionTokenKindBacktickTokenKindHashTokenKindEqualsTokenKindPlusEqualsTokenKindMinusEqualsTokenKindAsteriskEqualsTokenKindAsteriskAsteriskEqualsTokenKindSlashEqualsTokenKindPercentEqualsTokenKindLessThanLessThanEqualsTokenKindGreaterThanGreaterThanEqualsTokenKindGreaterThanGreaterThanGreaterThanEqualsTokenKindAmpersandEqualsTokenKindBarEqualsTokenKindBarBarEqualsTokenKindAmpersandAmpersandEqualsTokenKindQuestionQuestionEqualsTokenKindCaretEqualsTokenKindIdentifierKindPrivateIdentifierKindJSDocCommentTextTokenKindBreakKeywordKindCaseKeywordKindCatchKeywordKindClassKeywordKindConstKeywordKindContinueKeywordKindDebuggerKeywordKindDefaultKeywordKindDeleteKeywordKindDoKeywordKindElseKeywordKindEnumKeywordKindExportKeywordKindExtendsKeywordKindFalseKeywordKindFinallyKeywordKindForKeywordKindFunctionKeywordKindIfKeywordKindImportKeywordKindInKeywordKindInstanceOfKeywordKindNewKeywordKindNullKeywordKindReturnKeywordKindSuperKeywordKindSwitchKeywordKindThisKeywordKindThrowKeywordKindTrueKeywordKindTryKeywordKindTypeOfKeywordKindVarKeywordKindVoidKeywordKindWhileKeywordKindWithKeywordKindImplementsKeywordKindInterfaceKeywordKindLetKeywordKindPackageKeywordKindPrivateKeywordKindProtectedKeywordKindPublicKeywordKindStaticKeywordKindYieldKeywordKindAbstractKeywordKindAccessorKeywordKindAsKeywordKindAssertsKeywordKindAssertKeywordKindAnyKeywordKindAsyncKeywordKindAwaitKeywordKindBooleanKeywordKindConstructorKeywordKindDeclareKeywordKindGetKeywordKindImmediateKeywordKindInferKeywordKindIntrinsicKeywordKindIsKeywordKindKeyOfKeywordKindModuleKeywordKindNamespaceKeywordKindNeverKeywordKindOutKeywordKindReadonlyKeywordKindRequireKeywordKindNumberKeywordKindObjectKeywordKindSatisfiesKeywordKindSetKeywordKindStringKeywordKindSymbolKeywordKindTypeKeywordKindUndefinedKeywordKindUniqueKeywordKindUnknownKeywordKindUsingKeywordKindFromKeywordKindGlobalKeywordKindBigIntKeywordKindOverrideKeywordKindOfKeywordKindDeferKeywordKindSourceKeywordKindQualifiedNameKindComputedPropertyNameKindTypeParameterKindParameterKindDecoratorKindPropertySignatureKindPropertyDeclarationKindMethodSignatureKindMethodDeclarationKindClassStaticBlockDeclarationKindConstructorKindGetAccessorKindSetAccessorKindCallSignatureKindConstructSignatureKindIndexSignatureKindTypePredicateKindTypeReferenceKindFunctionTypeKindConstructorTypeKindTypeQueryKindTypeLiteralKindArrayTypeKindTupleTypeKindOptionalTypeKindRestTypeKindUnionTypeKindIntersectionTypeKindConditionalTypeKindInferTypeKindParenthesizedTypeKindThisTypeKindTypeOperatorKindIndexedAccessTypeKindMappedTypeKindLiteralTypeKindNamedTupleMemberKindTemplateLiteralTypeKindTemplateLiteralTypeSpanKindImportTypeKindObjectBindingPatternKindArrayBindingPatternKindBindingElementKindArrayLiteralExpressionKindObjectLiteralExpressionKindPropertyAccessExpressionKindElementAccessExpressionKindCallExpressionKindNewExpressionKindTaggedTemplateExpressionKindTypeAssertionExpressionKindParenthesizedExpressionKindFunctionExpressionKindArrowFunctionKindDeleteExpressionKindTypeOfExpressionKindVoidExpressionKindAwaitExpressionKindPrefixUnaryExpressionKindPostfixUnaryExpressionKindBinaryExpressionKindConditionalExpressionKindTemplateExpressionKindYieldExpressionKindSpreadElementKindClassExpressionKindOmittedExpressionKindExpressionWithTypeArgumentsKindAsExpressionKindNonNullExpressionKindMetaPropertyKindSyntheticExpressionKindSatisfiesExpressionKindTemplateSpanKindSemicolonClassElementKindBlockKindEmptyStatementKindVariableStatementKindExpressionStatementKindIfStatementKindDoStatementKindWhileStatementKindForStatementKindForInStatementKindForOfStatementKindContinueStatementKindBreakStatementKindReturnStatementKindWithStatementKindSwitchStatementKindLabeledStatementKindThrowStatementKindTryStatementKindDebuggerStatementKindVariableDeclarationKindVariableDeclarationListKindFunctionDeclarationKindClassDeclarationKindInterfaceDeclarationKindTypeAliasDeclarationKindEnumDeclarationKindModuleDeclarationKindModuleBlockKindCaseBlockKindNamespaceExportDeclarationKindImportEqualsDeclarationKindImportDeclarationKindImportClauseKindNamespaceImportKindNamedImportsKindImportSpecifierKindExportAssignmentKindExportDeclarationKindNamedExportsKindNamespaceExportKindExportSpecifierKindMissingDeclarationKindExternalModuleReferenceKindJsxElementKindJsxSelfClosingElementKindJsxOpeningElementKindJsxClosingElementKindJsxFragmentKindJsxOpeningFragmentKindJsxClosingFragmentKindJsxAttributeKindJsxAttributesKindJsxSpreadAttributeKindJsxExpressionKindJsxNamespacedNameKindCaseClauseKindDefaultClauseKindHeritageClauseKindCatchClauseKindImportAttributesKindImportAttributeKindPropertyAssignmentKindShorthandPropertyAssignmentKindSpreadAssignmentKindEnumMemberKindSourceFileKindJSDocTypeExpressionKindJSDocNameReferenceKindJSDocAllTypeKindJSDocNullableTypeKindJSDocNonNullableTypeKindJSDocOptionalTypeKindJSDocVariadicTypeKindJSDocKindJSDocTextKindJSDocTypeLiteralKindJSDocSignatureKindJSDocLinkKindJSDocLinkCodeKindJSDocLinkPlainKindJSDocUnknownTagKindJSDocAugmentsTagKindJSDocImplementsTagKindJSDocDeprecatedTagKindJSDocPublicTagKindJSDocPrivateTagKindJSDocProtectedTagKindJSDocReadonlyTagKindJSDocOverrideTagKindJSDocCallbackTagKindJSDocOverloadTagKindJSDocParameterTagKindJSDocReturnTagKindJSDocThisTagKindJSDocTypeTagKindJSDocTemplateTagKindJSDocTypedefTagKindJSDocSeeTagKindJSDocPropertyTagKindJSDocThrowsTagKindJSDocSatisfiesTagKindJSDocImportTagKindSyntaxListKindJSTypeAliasDeclarationKindJSImportDeclarationKindNotEmittedStatementKindPartiallyEmittedExpressionKindSyntheticReferenceExpressionKindNotEmittedTypeElementKindCount" -var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3140, 3157, 3181, 3198, 3211, 3224, 3245, 3268, 3287, 3308, 3339, 3354, 3369, 3384, 3401, 3423, 3441, 3458, 3475, 3491, 3510, 3523, 3538, 3551, 3564, 3580, 3592, 3605, 3625, 3644, 3657, 3678, 3690, 3706, 3727, 3741, 3756, 3776, 3799, 3826, 3840, 3864, 3887, 3905, 3931, 3958, 3986, 4013, 4031, 4048, 4076, 4103, 4130, 4152, 4169, 4189, 4209, 4227, 4246, 4271, 4297, 4317, 4342, 4364, 4383, 4400, 4419, 4440, 4471, 4487, 4508, 4524, 4547, 4570, 4586, 4611, 4620, 4638, 4659, 4682, 4697, 4712, 4730, 4746, 4764, 4782, 4803, 4821, 4840, 4857, 4876, 4896, 4914, 4930, 4951, 4974, 5001, 5024, 5044, 5068, 5092, 5111, 5132, 5147, 5160, 5190, 5217, 5238, 5254, 5273, 5289, 5308, 5328, 5349, 5365, 5384, 5403, 5425, 5452, 5466, 5491, 5512, 5533, 5548, 5570, 5592, 5608, 5625, 5647, 5664, 5685, 5699, 5716, 5734, 5749, 5769, 5788, 5810, 5841, 5861, 5875, 5889, 5912, 5934, 5950, 5971, 5995, 6016, 6037, 6046, 6059, 6079, 6097, 6110, 6127, 6145, 6164, 6184, 6206, 6228, 6246, 6265, 6286, 6306, 6326, 6346, 6366, 6387, 6405, 6421, 6437, 6457, 6476, 6491, 6511, 6529, 6550, 6568, 6582, 6608, 6631, 6654, 6684, 6716, 6741, 6750} +var _Kind_index = [...]uint16{0, 11, 24, 51, 77, 94, 114, 138, 165, 183, 200, 217, 228, 253, 281, 314, 330, 348, 364, 382, 401, 419, 438, 458, 479, 491, 509, 527, 541, 561, 578, 600, 620, 643, 669, 690, 716, 743, 775, 801, 814, 828, 845, 870, 884, 900, 917, 936, 961, 992, 1034, 1052, 1064, 1078, 1098, 1112, 1139, 1154, 1171, 1185, 1196, 1221, 1238, 1251, 1266, 1285, 1305, 1328, 1359, 1379, 1401, 1432, 1469, 1517, 1541, 1559, 1580, 1613, 1644, 1664, 1678, 1699, 1724, 1740, 1755, 1771, 1787, 1803, 1822, 1841, 1859, 1876, 1889, 1904, 1919, 1936, 1954, 1970, 1988, 2002, 2021, 2034, 2051, 2064, 2085, 2099, 2114, 2131, 2147, 2164, 2179, 2195, 2210, 2224, 2241, 2255, 2270, 2286, 2301, 2322, 2342, 2356, 2374, 2392, 2412, 2429, 2446, 2462, 2481, 2500, 2513, 2531, 2548, 2562, 2578, 2594, 2612, 2634, 2652, 2666, 2686, 2702, 2722, 2735, 2751, 2768, 2788, 2804, 2818, 2837, 2855, 2872, 2889, 2909, 2923, 2940, 2957, 2972, 2992, 3009, 3027, 3043, 3058, 3075, 3092, 3111, 3124, 3140, 3157, 3174, 3198, 3215, 3228, 3241, 3262, 3285, 3304, 3325, 3356, 3371, 3386, 3401, 3418, 3440, 3458, 3475, 3492, 3508, 3527, 3540, 3555, 3568, 3581, 3597, 3609, 3622, 3642, 3661, 3674, 3695, 3707, 3723, 3744, 3758, 3773, 3793, 3816, 3843, 3857, 3881, 3904, 3922, 3948, 3975, 4003, 4030, 4048, 4065, 4093, 4120, 4147, 4169, 4186, 4206, 4226, 4244, 4263, 4288, 4314, 4334, 4359, 4381, 4400, 4417, 4436, 4457, 4488, 4504, 4525, 4541, 4564, 4587, 4603, 4628, 4637, 4655, 4676, 4699, 4714, 4729, 4747, 4763, 4781, 4799, 4820, 4838, 4857, 4874, 4893, 4913, 4931, 4947, 4968, 4991, 5018, 5041, 5061, 5085, 5109, 5128, 5149, 5164, 5177, 5207, 5234, 5255, 5271, 5290, 5306, 5325, 5345, 5366, 5382, 5401, 5420, 5442, 5469, 5483, 5508, 5529, 5550, 5565, 5587, 5609, 5625, 5642, 5664, 5681, 5702, 5716, 5733, 5751, 5766, 5786, 5805, 5827, 5858, 5878, 5892, 5906, 5929, 5951, 5967, 5988, 6012, 6033, 6054, 6063, 6076, 6096, 6114, 6127, 6144, 6162, 6181, 6201, 6223, 6245, 6263, 6282, 6303, 6323, 6343, 6363, 6383, 6404, 6422, 6438, 6454, 6474, 6493, 6508, 6528, 6546, 6567, 6585, 6599, 6625, 6648, 6671, 6701, 6733, 6758, 6767} func (i Kind) String() string { idx := int(i) - 0 diff --git a/tsc/internal/ast/utilities.go b/tsc/internal/ast/utilities.go index 4a554a6f6755f..20492fbb54eb1 100644 --- a/tsc/internal/ast/utilities.go +++ b/tsc/internal/ast/utilities.go @@ -2006,7 +2006,7 @@ func IsExpressionNode(node *Node) bool { KindJsxFragment, KindYieldExpression, KindAwaitExpression: return true case KindMetaProperty: - // `import.defer` in `import.defer(...)` is not an expression + // `import.` in `import.(...)` is not an expression return !IsImportCall(node.Parent) || node.Parent.Expression() != node case KindExpressionWithTypeArguments: return !IsHeritageClause(node.Parent) @@ -2147,7 +2147,35 @@ func IsImportCall(node *Node) bool { return false } e := node.Expression() - return e.Kind == KindImportKeyword || IsMetaProperty(e) && e.AsMetaProperty().KeywordToken == KindImportKeyword && e.Text() == "defer" + return e.Kind == KindImportKeyword || IsImportPhaseMetaProperty(e) +} + +func IsImportPhaseMetaProperty(node *Node) bool { + return IsImportDeferMetaProperty(node) || IsImportSourceMetaProperty(node) +} + +func IsImportDeferMetaProperty(node *Node) bool { + return isImportMetaProperty(node, "defer") +} + +func IsImportSourceMetaProperty(node *Node) bool { + return isImportMetaProperty(node, "source") +} + +func isImportMetaProperty(node *Node, name string) bool { + return IsMetaProperty(node) && node.AsMetaProperty().KeywordToken == KindImportKeyword && node.AsMetaProperty().Name().Text() == name +} + +func IsSourcePhaseImport(node *Node) bool { + if IsImportDeclaration(node) { + clause := node.AsImportDeclaration().ImportClause + return clause != nil && clause.AsImportClause().PhaseModifier == KindSourceKeyword + } + return IsSourcePhaseImportCall(node) +} + +func IsSourcePhaseImportCall(node *Node) bool { + return IsCallExpression(node) && IsImportSourceMetaProperty(node.Expression()) } func IsComputedNonLiteralName(name *Node) bool { diff --git a/tsc/internal/bundled/embed_generated.go b/tsc/internal/bundled/embed_generated.go index 1b8714695980e..fb92b147506cc 100644 --- a/tsc/internal/bundled/embed_generated.go +++ b/tsc/internal/bundled/embed_generated.go @@ -219,6 +219,8 @@ var ( libs_lib_esnext_full_d_ts string //go:embed libs/lib.esnext.intl.d.ts libs_lib_esnext_intl_d_ts string + //go:embed libs/lib.esnext.modulesource.d.ts + libs_lib_esnext_modulesource_d_ts string //go:embed libs/lib.esnext.promise.d.ts libs_lib_esnext_promise_d_ts string //go:embed libs/lib.esnext.sharedmemory.d.ts @@ -344,6 +346,7 @@ var embeddedContents = map[string]string{ "libs/lib.esnext.disposable.d.ts": libs_lib_esnext_disposable_d_ts, "libs/lib.esnext.full.d.ts": libs_lib_esnext_full_d_ts, "libs/lib.esnext.intl.d.ts": libs_lib_esnext_intl_d_ts, + "libs/lib.esnext.modulesource.d.ts": libs_lib_esnext_modulesource_d_ts, "libs/lib.esnext.promise.d.ts": libs_lib_esnext_promise_d_ts, "libs/lib.esnext.sharedmemory.d.ts": libs_lib_esnext_sharedmemory_d_ts, "libs/lib.esnext.temporal.d.ts": libs_lib_esnext_temporal_d_ts, diff --git a/tsc/internal/bundled/libs/lib.esnext.d.ts b/tsc/internal/bundled/libs/lib.esnext.d.ts index f63bdbbf195b3..978c2262f6823 100644 --- a/tsc/internal/bundled/libs/lib.esnext.d.ts +++ b/tsc/internal/bundled/libs/lib.esnext.d.ts @@ -21,4 +21,5 @@ and limitations under the License. /// /// /// +/// /// diff --git a/tsc/internal/bundled/libs/lib.esnext.modulesource.d.ts b/tsc/internal/bundled/libs/lib.esnext.modulesource.d.ts new file mode 100644 index 0000000000000..25327ccd92f99 --- /dev/null +++ b/tsc/internal/bundled/libs/lib.esnext.modulesource.d.ts @@ -0,0 +1,21 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABILITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// + +interface AbstractModuleSource { + readonly [Symbol.toStringTag]: string; +} diff --git a/tsc/internal/bundled/libs_generated.go b/tsc/internal/bundled/libs_generated.go index 2d6bc7bdefe30..139a83e89edb1 100644 --- a/tsc/internal/bundled/libs_generated.go +++ b/tsc/internal/bundled/libs_generated.go @@ -111,6 +111,7 @@ var LibNames = []string{ "lib.esnext.disposable.d.ts", "lib.esnext.full.d.ts", "lib.esnext.intl.d.ts", + "lib.esnext.modulesource.d.ts", "lib.esnext.promise.d.ts", "lib.esnext.sharedmemory.d.ts", "lib.esnext.temporal.d.ts", diff --git a/tsc/internal/checker/checker.go b/tsc/internal/checker/checker.go index 6b1d3e44c08e0..549ec0804e37d 100644 --- a/tsc/internal/checker/checker.go +++ b/tsc/internal/checker/checker.go @@ -850,6 +850,7 @@ type Checker struct { getGlobalPromiseType func() *Type getGlobalPromiseTypeChecked func() *Type getGlobalPromiseLikeType func() *Type + getGlobalAbstractModuleSourceType func() *Type getGlobalPromiseConstructorSymbol func() *ast.Symbol getGlobalPromiseConstructorSymbolOrNil func() *ast.Symbol getGlobalOmitSymbol func() *ast.Symbol @@ -1091,6 +1092,7 @@ func NewChecker(program Program, tracer *Tracer) (*Checker, *sync.Mutex) { c.getGlobalPromiseType = c.getGlobalTypeResolver("Promise", 1 /*arity*/, false /*reportErrors*/) c.getGlobalPromiseTypeChecked = c.getGlobalTypeResolver("Promise", 1 /*arity*/, true /*reportErrors*/) c.getGlobalPromiseLikeType = c.getGlobalTypeResolver("PromiseLike", 1 /*arity*/, true /*reportErrors*/) + c.getGlobalAbstractModuleSourceType = c.getGlobalTypeResolver("AbstractModuleSource", 0 /*arity*/, true /*reportErrors*/) c.getGlobalPromiseConstructorSymbol = c.getGlobalValueSymbolResolver("Promise", true /*reportErrors*/) c.getGlobalPromiseConstructorSymbolOrNil = c.getGlobalValueSymbolResolver("Promise", false /*reportErrors*/) c.getGlobalOmitSymbol = c.getGlobalTypeAliasResolver("Omit", 2 /*arity*/, true /*reportErrors*/) @@ -8476,6 +8478,9 @@ func (c *Checker) checkImportCallExpression(node *ast.Node) *Type { } importAttributesType = c.getTypeOfPropertyOfType(optionsType, "with") } + if ast.IsSourcePhaseImportCall(node) { + return c.createPromiseReturnType(node, c.getGlobalAbstractModuleSourceType()) + } // resolveExternalModuleName will return undefined if the moduleReferenceExpression is not a string literal moduleSymbol := c.resolveExternalModuleName(node, specifier, false /*ignoreErrors*/, importAttributesType) if moduleSymbol != nil { @@ -10959,8 +10964,10 @@ func (c *Checker) checkMetaProperty(node *ast.Node) *Type { case ast.KindNewKeyword: return c.checkNewTargetMetaProperty(node) case ast.KindImportKeyword: - if node.Name().Text() == "defer" { - debug.Assert(!ast.IsCallExpression(node.Parent) || node.Parent.Expression() != node, "Trying to get the type of `import.defer` in `import.defer(...)`") + if ast.IsImportPhaseMetaProperty(node.AsNode()) { + if ast.IsCallExpression(node.Parent) { + debug.Assert(node.Parent.Expression() != node, "Trying to get the type of a phase import meta-property in its call") + } return c.errorType } return c.checkImportMetaProperty(node) @@ -14758,6 +14765,17 @@ func (c *Checker) getTypeOnlyDeclarationOfEntityName(name *ast.Node) *ast.Node { } func (c *Checker) getTargetOfImportClause(node *ast.Node) *ast.Symbol { + if node.AsImportClause().PhaseModifier == ast.KindSourceKeyword { + alias := c.getSymbolOfDeclaration(node) + links := c.aliasSymbolLinks.Get(alias) + if links.immediateTarget == nil { + symbol := c.newSymbol(ast.SymbolFlagsFunctionScopedVariable, node.Name().Text()) + symbol.Declarations = alias.Declarations + c.valueSymbolLinks.Get(symbol).resolvedType = c.getGlobalAbstractModuleSourceType() + links.immediateTarget = symbol + } + return links.immediateTarget + } moduleSymbol := c.resolveExternalModuleName(node, getModuleSpecifierFromNode(node.Parent), false /*ignoreErrors*/, c.getTypeFromImportAttributes(ast.GetImportAttributes(node.Parent))) if moduleSymbol != nil { return c.getTargetOfModuleDefault(moduleSymbol, node, true /*dontResolveAlias*/) @@ -15367,6 +15385,9 @@ func (c *Checker) getCannotResolveModuleNameErrorForSpecificModule(moduleName *a func (c *Checker) resolveExternalModuleNameWorker(location *ast.Node, moduleReferenceExpression *ast.Node, moduleNotFoundError *diagnostics.Message, ignoreErrors bool, isForAugmentation bool, importAttributesType *Type) *ast.Symbol { if ast.IsStringLiteralLike(moduleReferenceExpression) { + if ast.IsSourcePhaseImport(moduleReferenceExpression.Parent) { + return nil + } return c.resolveExternalModule(location, moduleReferenceExpression.Text(), moduleNotFoundError, core.IfElse(!ignoreErrors, moduleReferenceExpression, nil), isForAugmentation, importAttributesType) } return nil @@ -32223,7 +32244,7 @@ func (c *Checker) getSymbolAtLocation(node *ast.Node, ignoreErrors bool) *ast.Sy } return nil case ast.KindImportKeyword: - if ast.IsMetaProperty(node.Parent) && node.Parent.Text() == "defer" { + if ast.IsImportPhaseMetaProperty(node.Parent) { return nil } fallthrough diff --git a/tsc/internal/checker/grammarchecks.go b/tsc/internal/checker/grammarchecks.go index b49cfa29f6b7a..077e1d0deb06a 100644 --- a/tsc/internal/checker/grammarchecks.go +++ b/tsc/internal/checker/grammarchecks.go @@ -1822,13 +1822,13 @@ func (c *Checker) checkGrammarMetaProperty(node *ast.MetaProperty) bool { case ast.KindImportKeyword: if nameText != "meta" { isCallee := ast.IsCallExpression(node.Parent) && node.Parent.Expression() == node.AsNode() - if nameText == "defer" { + if ast.IsImportPhaseMetaProperty(node.AsNode()) { if !isCallee { return c.grammarErrorAtPos(node.AsNode(), node.AsNode().End(), 0, diagnostics.X_0_expected, "(") } } else { if isCallee { - return c.grammarErrorOnNode(nodeName, diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_or_defer, nameText) + return c.grammarErrorOnNode(nodeName, diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source, nameText) } return c.grammarErrorOnNode(nodeName, diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, nameText, scanner.TokenToString(node.KeywordToken), "meta") } @@ -2113,9 +2113,25 @@ func (c *Checker) checkGrammarImportClause(node *ast.ImportClause) bool { if node.NamedBindings != nil && node.NamedBindings.Kind == ast.KindNamedImports { return c.grammarErrorOnNode(&node.Node, diagnostics.Named_imports_are_not_allowed_in_a_deferred_import) } - if c.moduleKind != core.ModuleKindESNext && c.moduleKind != core.ModuleKindPreserve { - return c.grammarErrorOnNode(&node.Node, diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve) + if c.moduleKind.SupportsDeferredImports() { + break + } + return c.grammarErrorOnNode(&node.Node, diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve) + case ast.KindSourceKeyword: + if node.NamedBindings != nil { + return c.grammarErrorOnNode(&node.Node, diagnostics.Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import) + } + if node.Name() == nil { + return c.grammarErrorOnNode(&node.Node, diagnostics.A_source_phase_import_must_specify_a_local_binding) + } + if c.moduleKind.SupportsSourcePhaseImports() { + moduleSpecifier := getModuleSpecifierFromNode(node.Parent) + if c.getEmitSyntaxForModuleSpecifierExpression(moduleSpecifier) == core.ModuleKindCommonJS { + return c.grammarErrorOnNode(&node.Node, diagnostics.Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls) + } + break } + return c.grammarErrorOnNode(&node.Node, diagnostics.Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve) } return false } @@ -2159,15 +2175,25 @@ func (c *Checker) checkGrammarImportCallExpression(node *ast.Node) bool { return c.grammarErrorOnNode(node, getVerbatimModuleSyntaxErrorMessage(node)) } - if node.Expression().Kind == ast.KindMetaProperty { - if c.moduleKind != core.ModuleKindESNext && c.moduleKind != core.ModuleKindPreserve { - return c.grammarErrorOnNode(node, diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve) + switch { + case ast.IsImportSourceMetaProperty(node.Expression()): + if c.moduleKind.SupportsSourcePhaseImports() { + break } - } else if c.moduleKind == core.ModuleKindES2015 { + return c.grammarErrorOnNode(node, diagnostics.Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve) + case ast.IsImportDeferMetaProperty(node.Expression()): + if c.moduleKind.SupportsDeferredImports() { + break + } + return c.grammarErrorOnNode(node, diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve) + case c.moduleKind == core.ModuleKindES2015: return c.grammarErrorOnNode(node, diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_node20_or_nodenext) } nodeAsCall := node.AsCallExpression() + if ast.IsSourcePhaseImportCall(node) && nodeAsCall.QuestionDotToken != nil { + return c.grammarErrorOnNode(nodeAsCall.QuestionDotToken, diagnostics.Optional_chaining_cannot_be_used_with_import_source) + } if nodeAsCall.TypeArguments != nil { return c.grammarErrorOnNode(node, diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments) } diff --git a/tsc/internal/compiler/fileloader.go b/tsc/internal/compiler/fileloader.go index 9782b2664506e..14662760dd852 100644 --- a/tsc/internal/compiler/fileloader.go +++ b/tsc/internal/compiler/fileloader.go @@ -881,7 +881,7 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(t *parseTask) { for index, entry := range moduleNames { moduleName := entry.Text() - if moduleName == "" { + if moduleName == "" || ast.IsSourcePhaseImport(entry.Parent) { continue } @@ -1089,12 +1089,14 @@ func getEmitSyntaxForUsageLocationWorker(fileName string, meta ast.SourceFileMet return core.ModuleKindCommonJS } fileEmitMode := ast.GetEmitModuleFormatOfFileWorker(fileName, options, meta) - if ast.IsImportCall(ast.WalkUpParenthesizedExpressions(usage.Parent)) { + if call := ast.WalkUpParenthesizedExpressions(usage.Parent); ast.IsImportCall(call) { + if ast.IsSourcePhaseImportCall(call) { + return core.ModuleKindESNext + } if ast.ShouldTransformImportCall(fileName, options, fileEmitMode) { return core.ModuleKindCommonJS - } else { - return core.ModuleKindESNext } + return core.ModuleKindESNext } // If we're in --module preserve on an input file, we know that an import // is an import. But if this is a declaration file, we'd prefer to use the diff --git a/tsc/internal/compiler/program.go b/tsc/internal/compiler/program.go index c0fb38b3bff6f..8769dfbea0acf 100644 --- a/tsc/internal/compiler/program.go +++ b/tsc/internal/compiler/program.go @@ -467,7 +467,8 @@ func (p *Program) canReplaceFileInProgram(file1 *ast.SourceFile, file2 *ast.Sour file1.UsesUriStyleNodeCoreModules == file2.UsesUriStyleNodeCoreModules && slices.EqualFunc(file1.Imports(), file2.Imports(), func(n1 *ast.Node, n2 *ast.Node) bool { return equalModuleSpecifiers(n1, n2) && - p.GetModeForUsageLocation(file1, n1) == p.GetModeForUsageLocation(file2, n2) + p.GetModeForUsageLocation(file1, n1) == p.GetModeForUsageLocation(file2, n2) && + ast.IsSourcePhaseImport(n1.Parent) == ast.IsSourcePhaseImport(n2.Parent) }) && slices.EqualFunc(file1.ModuleAugmentations, file2.ModuleAugmentations, equalModuleAugmentationNames) && slices.Equal(file1.AmbientModuleNames, file2.AmbientModuleNames) && @@ -641,6 +642,9 @@ func (p *Program) GetResolvedModuleFromModuleSpecifier(file ast.HasFileName, mod if !ast.IsStringLiteralLike(moduleSpecifier) { panic("moduleSpecifier must be a StringLiteralLike") } + if ast.IsSourcePhaseImport(moduleSpecifier.Parent) { + return nil + } mode := p.GetModeForUsageLocation(file, moduleSpecifier) return p.GetResolvedModule(file, moduleSpecifier.Text(), mode) } @@ -2242,7 +2246,7 @@ func (p *Program) collectPackageNames() *packageNamesInfo { continue } for _, imp := range file.Imports() { - if tspath.IsExternalModuleNameRelative(imp.Text()) { + if ast.IsSourcePhaseImport(imp.Parent) || tspath.IsExternalModuleNameRelative(imp.Text()) { continue } if resolvedModules, ok := p.resolvedModules[file.Path()]; ok { @@ -2419,6 +2423,7 @@ var plainJSErrors = collections.NewSetFromItems( diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.Code(), diagnostics.A_set_accessor_cannot_have_rest_parameter.Code(), diagnostics.A_set_accessor_must_have_exactly_one_parameter.Code(), + diagnostics.A_source_phase_import_must_specify_a_local_binding.Code(), diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module.Code(), diagnostics.An_export_declaration_cannot_have_modifiers.Code(), diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module.Code(), @@ -2442,11 +2447,15 @@ var plainJSErrors = collections.NewSetFromItems( diagnostics.Jump_target_cannot_cross_function_boundary.Code(), diagnostics.Line_terminator_not_permitted_before_arrow.Code(), diagnostics.Modifiers_cannot_appear_here.Code(), + diagnostics.Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import.Code(), diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.Code(), diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.Code(), + diagnostics.Optional_chaining_cannot_be_used_with_import_source.Code(), diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.Code(), diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.Code(), diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.Code(), + diagnostics.Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls.Code(), + diagnostics.Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve.Code(), diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.Code(), diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.Code(), diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.Code(), @@ -2455,6 +2464,7 @@ var plainJSErrors = collections.NewSetFromItems( diagnostics.Variable_declaration_list_cannot_be_empty.Code(), diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses.Code(), diagnostics.X_0_expected.Code(), + diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source.Code(), diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.Code(), diagnostics.X_0_list_cannot_be_empty.Code(), diagnostics.X_0_modifier_already_seen.Code(), diff --git a/tsc/internal/compiler/program_test.go b/tsc/internal/compiler/program_test.go index b910c8081299f..0f557b7dad7e2 100644 --- a/tsc/internal/compiler/program_test.go +++ b/tsc/internal/compiler/program_test.go @@ -333,6 +333,7 @@ var esnextLibs = []string{ "lib.esnext.decorators.d.ts", "lib.esnext.disposable.d.ts", "lib.esnext.intl.d.ts", + "lib.esnext.modulesource.d.ts", "lib.esnext.sharedmemory.d.ts", "lib.esnext.temporal.d.ts", "lib.decorators.d.ts", @@ -478,6 +479,62 @@ func TestProgram(t *testing.T) { } } +func TestImportSourceProgram(t *testing.T) { + t.Parallel() + for _, test := range []struct { + name string + source string + evaluation string + }{ + {"static", `import source a from "./a.js";`, `import { a as value } from "./a.js";`}, + {"dynamic", `import.source("./a.js");`, `import("./a.js");`}, + } { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + content := test.source + `import source b from "missing"; import.source("other");` + files := map[string]any{ + "/src/tsconfig.json": `{"compilerOptions":{"module":"esnext","noLib":true},"files":["index.ts"]}`, + "/src/index.ts": content, + "/src/a.ts": "export const a = 1;", + } + host := NewCompilerHost("/", vfstest.FromMap(files, true), "", nil, nil, nil) + config, diagnostics := tsoptions.GetParsedCommandLineOfConfigFile("/src/tsconfig.json", nil, nil, host, nil) + assert.Equal(t, len(diagnostics), 0) + program := NewProgram(ProgramOptions{Config: config, Host: host}) + file := program.GetSourceFile("/src/index.ts") + assert.Assert(t, program.GetSourceFile("/src/a.ts") == nil) + assert.Equal(t, len(program.GetResolvedModules()[file.Path()]), 0) + assert.Equal(t, program.GetUnresolvedImports().Len(), 0) + assert.Equal(t, program.collectPackageNames().unresolved.Len(), 0) + + files["/src/index.ts"] = test.evaluation + strings.TrimPrefix(content, test.source) + host = NewCompilerHost("/", vfstest.FromMap(files, true), "", nil, nil, nil) + program, file, reused := program.UpdateProgram("/src/index.ts", host, nil, nil) + assert.Assert(t, !reused) + assert.Assert(t, program.GetSourceFile("/src/a.ts") != nil) + for _, specifier := range file.Imports() { + resolved := program.GetResolvedModuleFromModuleSpecifier(file, specifier) + assert.Equal(t, resolved.IsResolved(), !ast.IsSourcePhaseImport(specifier.Parent)) + } + + files["/src/index.ts"] = content + host = NewCompilerHost("/", vfstest.FromMap(files, true), "", nil, nil, nil) + program, _, reused = program.UpdateProgram("/src/index.ts", host, nil, nil) + assert.Assert(t, !reused) + assert.Assert(t, program.GetSourceFile("/src/a.ts") == nil) + + files["/src/index.ts"] = test.evaluation + content + host = NewCompilerHost("/", vfstest.FromMap(files, true), "", nil, nil, nil) + program = NewProgram(ProgramOptions{Config: config, Host: host}) + file = program.GetSourceFile("/src/index.ts") + for _, specifier := range file.Imports() { + resolved := program.GetResolvedModuleFromModuleSpecifier(file, specifier) + assert.Equal(t, resolved.IsResolved(), !ast.IsSourcePhaseImport(specifier.Parent)) + } + }) + } +} + func TestIncludeProcessorDiagnosticsWithMissingFileCasing(t *testing.T) { t.Parallel() diff --git a/tsc/internal/core/compileroptions.go b/tsc/internal/core/compileroptions.go index a8efb73a4c7f1..3b1c1ff5f903f 100644 --- a/tsc/internal/core/compileroptions.go +++ b/tsc/internal/core/compileroptions.go @@ -210,6 +210,14 @@ func (moduleKind ModuleKind) SupportsImportAttributes() bool { moduleKind == ModuleKindESNext } +func (moduleKind ModuleKind) SupportsDeferredImports() bool { + return moduleKind == ModuleKindESNext || moduleKind == ModuleKindPreserve +} + +func (moduleKind ModuleKind) SupportsSourcePhaseImports() bool { + return moduleKind == ModuleKindESNext || moduleKind == ModuleKindNodeNext || moduleKind == ModuleKindPreserve +} + type ResolutionMode = ModuleKind // ModuleKindNone | ModuleKindCommonJS | ModuleKindESNext const ( diff --git a/tsc/internal/diagnostics/diagnosticMessages.generated.json b/tsc/internal/diagnostics/diagnosticMessages.generated.json index 9ca4c7bdf1d77..cf66284f21b0a 100644 --- a/tsc/internal/diagnostics/diagnosticMessages.generated.json +++ b/tsc/internal/diagnostics/diagnosticMessages.generated.json @@ -1894,7 +1894,7 @@ "Default_imports_are_not_allowed_in_a_deferred_import_18058": "Default imports are not allowed in a deferred import.", "Named_imports_are_not_allowed_in_a_deferred_import_18059": "Named imports are not allowed in a deferred import.", "Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve_18060": "Deferred imports are only supported when the '--module' flag is set to 'esnext' or 'preserve'.", - "_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_or_defer_18061": "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'?", + "_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source_18061": "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'?", "Regular_expression_pattern_modifiers_are_only_available_when_targeting_0_or_later_18062": "Regular expression pattern modifiers are only available when targeting '{0}' or later.", "Duplicate_named_capturing_groups_are_only_available_when_targeting_0_or_later_18063": "Duplicate named capturing groups are only available when targeting '{0}' or later.", "Private_identifiers_cannot_be_used_in_destructuring_patterns_18064": "Private identifiers cannot be used in destructuring patterns.", @@ -1944,6 +1944,11 @@ "The_content_mapper_returned_diagnostic_directives_with_overlapping_virtual_ranges_18108": "The content mapper returned diagnostic directives with overlapping virtual ranges.", "The_invalid_diagnostic_directive_is_in_supplemental_output_0_returned_by_the_content_mapper_18109": "The invalid diagnostic directive is in supplemental output {0} returned by the content mapper.", "Diagnostic_directive_0_returned_by_the_content_mapper_has_an_invalid_unusedExpectDirectiveIndex_18110": "Diagnostic directive {0} returned by the content mapper has an invalid 'unusedExpectDirectiveIndex'.", + "A_source_phase_import_must_specify_a_local_binding_18111": "A source phase import must specify a local binding.", + "Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import_18112": "Named and namespace imports are not allowed in a source phase import.", + "Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_18113": "Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.", + "Optional_chaining_cannot_be_used_with_import_source_18114": "Optional chaining cannot be used with 'import.source'.", + "Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_18115": "Source phase imports are not allowed on statements that compile to CommonJS 'require' calls.", "nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler_69010": "`nodenext` if `module` is `nodenext`; `node16` if `module` is `node16` or `node18`; otherwise, `bundler`.", "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001": "File is a CommonJS module; it may be converted to an ES module.", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "This constructor function may be converted to a class declaration.", diff --git a/tsc/internal/diagnostics/diagnosticMessages.json b/tsc/internal/diagnostics/diagnosticMessages.json index edc52a66cb04a..be00151a57d6a 100644 --- a/tsc/internal/diagnostics/diagnosticMessages.json +++ b/tsc/internal/diagnostics/diagnosticMessages.json @@ -8696,7 +8696,7 @@ "category": "Error", "code": 18060 }, - "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'?": { + "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'?": { "category": "Error", "code": 18061 }, @@ -8895,5 +8895,25 @@ "Diagnostic directive {0} returned by the content mapper has an invalid 'unusedExpectDirectiveIndex'.": { "category": "Message", "code": 18110 + }, + "A source phase import must specify a local binding.": { + "category": "Error", + "code": 18111 + }, + "Named and namespace imports are not allowed in a source phase import.": { + "category": "Error", + "code": 18112 + }, + "Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'.": { + "category": "Error", + "code": 18113 + }, + "Optional chaining cannot be used with 'import.source'.": { + "category": "Error", + "code": 18114 + }, + "Source phase imports are not allowed on statements that compile to CommonJS 'require' calls.": { + "category": "Error", + "code": 18115 } } diff --git a/tsc/internal/diagnostics/diagnostics_generated.go b/tsc/internal/diagnostics/diagnostics_generated.go index cd93d383cdbc0..8a28f92aa3f1f 100644 --- a/tsc/internal/diagnostics/diagnostics_generated.go +++ b/tsc/internal/diagnostics/diagnostics_generated.go @@ -3792,7 +3792,7 @@ var Named_imports_are_not_allowed_in_a_deferred_import = &Message{code: 18059, c var Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve = &Message{code: 18060, category: CategoryError, key: "Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve_18060", text: "Deferred imports are only supported when the '--module' flag is set to 'esnext' or 'preserve'."} -var X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_or_defer = &Message{code: 18061, category: CategoryError, key: "_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_or_defer_18061", text: "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'?"} +var X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source = &Message{code: 18061, category: CategoryError, key: "_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source_18061", text: "'{0}' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'?"} var Regular_expression_pattern_modifiers_are_only_available_when_targeting_0_or_later = &Message{code: 18062, category: CategoryError, key: "Regular_expression_pattern_modifiers_are_only_available_when_targeting_0_or_later_18062", text: "Regular expression pattern modifiers are only available when targeting '{0}' or later."} @@ -3892,6 +3892,16 @@ var The_invalid_diagnostic_directive_is_in_supplemental_output_0_returned_by_the var Diagnostic_directive_0_returned_by_the_content_mapper_has_an_invalid_unusedExpectDirectiveIndex = &Message{code: 18110, category: CategoryMessage, key: "Diagnostic_directive_0_returned_by_the_content_mapper_has_an_invalid_unusedExpectDirectiveIndex_18110", text: "Diagnostic directive {0} returned by the content mapper has an invalid 'unusedExpectDirectiveIndex'."} +var A_source_phase_import_must_specify_a_local_binding = &Message{code: 18111, category: CategoryError, key: "A_source_phase_import_must_specify_a_local_binding_18111", text: "A source phase import must specify a local binding."} + +var Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import = &Message{code: 18112, category: CategoryError, key: "Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import_18112", text: "Named and namespace imports are not allowed in a source phase import."} + +var Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve = &Message{code: 18113, category: CategoryError, key: "Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_18113", text: "Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."} + +var Optional_chaining_cannot_be_used_with_import_source = &Message{code: 18114, category: CategoryError, key: "Optional_chaining_cannot_be_used_with_import_source_18114", text: "Optional chaining cannot be used with 'import.source'."} + +var Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls = &Message{code: 18115, category: CategoryError, key: "Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_18115", text: "Source phase imports are not allowed on statements that compile to CommonJS 'require' calls."} + var X_nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler = &Message{code: 69010, category: CategoryMessage, key: "nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler_69010", text: "`nodenext` if `module` is `nodenext`; `node16` if `module` is `node16` or `node18`; otherwise, `bundler`."} var File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module = &Message{code: 80001, category: CategorySuggestion, key: "File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module_80001", text: "File is a CommonJS module; it may be converted to an ES module."} @@ -6328,7 +6338,7 @@ var allMessages = [...]**Message{ &Default_imports_are_not_allowed_in_a_deferred_import, &Named_imports_are_not_allowed_in_a_deferred_import, &Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve, - &X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_or_defer, + &X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source, &Regular_expression_pattern_modifiers_are_only_available_when_targeting_0_or_later, &Duplicate_named_capturing_groups_are_only_available_when_targeting_0_or_later, &Private_identifiers_cannot_be_used_in_destructuring_patterns, @@ -6378,6 +6388,11 @@ var allMessages = [...]**Message{ &The_content_mapper_returned_diagnostic_directives_with_overlapping_virtual_ranges, &The_invalid_diagnostic_directive_is_in_supplemental_output_0_returned_by_the_content_mapper, &Diagnostic_directive_0_returned_by_the_content_mapper_has_an_invalid_unusedExpectDirectiveIndex, + &A_source_phase_import_must_specify_a_local_binding, + &Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import, + &Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve, + &Optional_chaining_cannot_be_used_with_import_source, + &Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls, &X_nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler, &File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module, &This_constructor_function_may_be_converted_to_a_class_declaration, diff --git a/tsc/internal/diagnostics/loc/cs-CZ.json.gz b/tsc/internal/diagnostics/loc/cs-CZ.json.gz index 8dc7ed722c0e7..3802ae82535f4 100644 Binary files a/tsc/internal/diagnostics/loc/cs-CZ.json.gz and b/tsc/internal/diagnostics/loc/cs-CZ.json.gz differ diff --git a/tsc/internal/diagnostics/loc/de-DE.json.gz b/tsc/internal/diagnostics/loc/de-DE.json.gz index 2b2ce37761068..1a4ee63c17e3e 100644 Binary files a/tsc/internal/diagnostics/loc/de-DE.json.gz and b/tsc/internal/diagnostics/loc/de-DE.json.gz differ diff --git a/tsc/internal/diagnostics/loc/es-ES.json.gz b/tsc/internal/diagnostics/loc/es-ES.json.gz index ea7b2fe4852c4..343d43538ecec 100644 Binary files a/tsc/internal/diagnostics/loc/es-ES.json.gz and b/tsc/internal/diagnostics/loc/es-ES.json.gz differ diff --git a/tsc/internal/diagnostics/loc/fr-FR.json.gz b/tsc/internal/diagnostics/loc/fr-FR.json.gz index bb643415f0060..8a14cc14bc162 100644 Binary files a/tsc/internal/diagnostics/loc/fr-FR.json.gz and b/tsc/internal/diagnostics/loc/fr-FR.json.gz differ diff --git a/tsc/internal/diagnostics/loc/it-IT.json.gz b/tsc/internal/diagnostics/loc/it-IT.json.gz index df33a1298ed1c..7324edb7c459c 100644 Binary files a/tsc/internal/diagnostics/loc/it-IT.json.gz and b/tsc/internal/diagnostics/loc/it-IT.json.gz differ diff --git a/tsc/internal/diagnostics/loc/ja-JP.json.gz b/tsc/internal/diagnostics/loc/ja-JP.json.gz index c0b74b6e08943..da97d464ff6ee 100644 Binary files a/tsc/internal/diagnostics/loc/ja-JP.json.gz and b/tsc/internal/diagnostics/loc/ja-JP.json.gz differ diff --git a/tsc/internal/diagnostics/loc/ko-KR.json.gz b/tsc/internal/diagnostics/loc/ko-KR.json.gz index 05533911776d4..0fed9f4baad87 100644 Binary files a/tsc/internal/diagnostics/loc/ko-KR.json.gz and b/tsc/internal/diagnostics/loc/ko-KR.json.gz differ diff --git a/tsc/internal/diagnostics/loc/pl-PL.json.gz b/tsc/internal/diagnostics/loc/pl-PL.json.gz index 52354c8c87ebc..ec8c370051657 100644 Binary files a/tsc/internal/diagnostics/loc/pl-PL.json.gz and b/tsc/internal/diagnostics/loc/pl-PL.json.gz differ diff --git a/tsc/internal/diagnostics/loc/pt-BR.json.gz b/tsc/internal/diagnostics/loc/pt-BR.json.gz index 35093d14d301f..f7f795223174f 100644 Binary files a/tsc/internal/diagnostics/loc/pt-BR.json.gz and b/tsc/internal/diagnostics/loc/pt-BR.json.gz differ diff --git a/tsc/internal/diagnostics/loc/ru-RU.json.gz b/tsc/internal/diagnostics/loc/ru-RU.json.gz index 4556ffc2fa643..cb098667a5d80 100644 Binary files a/tsc/internal/diagnostics/loc/ru-RU.json.gz and b/tsc/internal/diagnostics/loc/ru-RU.json.gz differ diff --git a/tsc/internal/diagnostics/loc/tr-TR.json.gz b/tsc/internal/diagnostics/loc/tr-TR.json.gz index 7ce421335fceb..a4a0a3bf596f4 100644 Binary files a/tsc/internal/diagnostics/loc/tr-TR.json.gz and b/tsc/internal/diagnostics/loc/tr-TR.json.gz differ diff --git a/tsc/internal/diagnostics/loc/zh-CN.json.gz b/tsc/internal/diagnostics/loc/zh-CN.json.gz index 2f22028d4fe67..1292fbcefa787 100644 Binary files a/tsc/internal/diagnostics/loc/zh-CN.json.gz and b/tsc/internal/diagnostics/loc/zh-CN.json.gz differ diff --git a/tsc/internal/diagnostics/loc/zh-TW.json.gz b/tsc/internal/diagnostics/loc/zh-TW.json.gz index b6900d72972e5..bd2489b28d6ee 100644 Binary files a/tsc/internal/diagnostics/loc/zh-TW.json.gz and b/tsc/internal/diagnostics/loc/zh-TW.json.gz differ diff --git a/tsc/internal/fourslash/tests/autoImport_sourcePhase_test.go b/tsc/internal/fourslash/tests/autoImport_sourcePhase_test.go new file mode 100644 index 0000000000000..d2517f3ee5459 --- /dev/null +++ b/tsc/internal/fourslash/tests/autoImport_sourcePhase_test.go @@ -0,0 +1,32 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/TypeScript/tsc/internal/fourslash" + "github.com/microsoft/TypeScript/tsc/internal/testutil" +) + +func TestAutoImportDoesNotAddToSourcePhaseImport(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @Filename: /a.ts +const a = 0; +export default a; +export const b = 1; + +// @Filename: /b.ts +import source a from "./a"; +a; +b/**/` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.GoToMarker(t, "") + f.VerifyImportFixAtPosition(t, []string{ + `import source a from "./a"; +import { b } from "./a"; +a; +b`, + }, nil /*preferences*/) +} diff --git a/tsc/internal/fourslash/tests/goToDefinition_sourcePhase_test.go b/tsc/internal/fourslash/tests/goToDefinition_sourcePhase_test.go new file mode 100644 index 0000000000000..195eb3e52a683 --- /dev/null +++ b/tsc/internal/fourslash/tests/goToDefinition_sourcePhase_test.go @@ -0,0 +1,43 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/TypeScript/tsc/internal/fourslash" + "github.com/microsoft/TypeScript/tsc/internal/testutil" +) + +func TestGoToDefinition_sourcePhase(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @target: esnext + +// @filename: /b.ts +import source b from "./a.wasm"; +[|/*bUse*/b|]; +export { b }; + +// @filename: /c.ts +import source c from "./a.wasm"; +[|/*cUse*/c|]; + +// @filename: /d.ts +import { /*dImport*/b as d } from "./b"; +/*dUse*/d; + +// @filename: /e.ts +export { b as /*eExport*/e } from "./b"; + +// @filename: /f.ts +import { e as f } from "./e"; +/*fUse*/f; +import * as ns from "./e"; +ns./*property*/e;` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyNoErrors(t) + f.VerifyBaselineGoToDefinition(t, true, "bUse", "cUse", "dImport", "dUse", "eExport", "fUse", "property") + f.VerifyBaselineGoToSourceDefinition(t, "bUse", "cUse", "dImport", "dUse", "eExport", "fUse", "property") + f.VerifyBaselineFindAllReferences(t, "bUse", "cUse") +} diff --git a/tsc/internal/fourslash/tests/goToSourceDefinitionImportSource_test.go b/tsc/internal/fourslash/tests/goToSourceDefinitionImportSource_test.go new file mode 100644 index 0000000000000..7ac5080fcfb6e --- /dev/null +++ b/tsc/internal/fourslash/tests/goToSourceDefinitionImportSource_test.go @@ -0,0 +1,37 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/TypeScript/tsc/internal/fourslash" + "github.com/microsoft/TypeScript/tsc/internal/testutil" +) + +func TestGoToSourceDefinitionImportSource(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @target: esnext +// @allowJs: true + +// @filename: /a.js +const x = 1; +export default function f() {} +const g = 2; + +// @filename: /a.wasm +wasm + +// @filename: /b.ts +import /*f*/f from "./a.js"; +/*fUse*/f(); +import source /*g*/g from "/*js*/./a.js"; +/*gUse*/g; +import source /*h*/h from "/*wasm*/./a.wasm"; +/*hUse*/h; +import.source("/*dynamic*/./a.js");` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyBaselineGoToDefinition(t, true, "f", "fUse", "g", "gUse", "h", "hUse", "js", "wasm", "dynamic") + f.VerifyBaselineGoToSourceDefinition(t, "f", "fUse", "g", "gUse", "h", "hUse", "js", "wasm", "dynamic") +} diff --git a/tsc/internal/fourslash/tests/organizeImports_sourcePhase_test.go b/tsc/internal/fourslash/tests/organizeImports_sourcePhase_test.go new file mode 100644 index 0000000000000..15947ff91d9b5 --- /dev/null +++ b/tsc/internal/fourslash/tests/organizeImports_sourcePhase_test.go @@ -0,0 +1,117 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/TypeScript/tsc/internal/fourslash" + "github.com/microsoft/TypeScript/tsc/internal/ls/lsutil" + "github.com/microsoft/TypeScript/tsc/internal/lsp/lsproto" + "github.com/microsoft/TypeScript/tsc/internal/testutil" +) + +func TestOrganizeImports_sourcePhaseImportsAreNotCoalesced(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `import source b from "lib"; +import source a from "lib"; +a; b;` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyOrganizeImports( + t, + `import source a from "lib"; +import source b from "lib"; +a; b;`, + lsproto.CodeActionKindSourceSortImportsTs, + &lsutil.UserPreferences{OrganizeImportsSort: lsutil.OrganizeImportsSortOrdinalIgnoreCase}, + ) +} + +func TestOrganizeImports_sourceAndEvaluationPhaseImportsAreNotCoalesced(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `import { c } from "lib"; +import source b from "lib"; +import { a } from "lib"; +a; b; c;` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyOrganizeImports( + t, + `import source b from "lib"; +import { a, c } from "lib"; +a; b; c;`, + lsproto.CodeActionKindSourceSortImportsTs, + &lsutil.UserPreferences{OrganizeImportsSort: lsutil.OrganizeImportsSortOrdinalIgnoreCase}, + ) +} + +func TestOrganizeImports_sourcePhaseImportSorting(t *testing.T) { + t.Parallel() + const imports = `import source a from "lib"; +import source b from "lib"; +import source c from "lib"; +import source d from "lib"; +import source e from "lib"; +import source f from "lib"; +import source g from "lib"; +import source h from "lib"; +import source i from "lib"; +import source j from "lib"; +import source k from "lib"; +import source l from "lib"; +import source m from "lib"; +` + for _, test := range []struct { + name string + content string + expected string + }{ + { + name: "case insensitive bindings", + content: `import { b, D } from "B"; +import "a"; +import source C from "lib"; +import source a from "lib";`, + expected: `import { b, D } from "B"; +import "a"; +import source a from "lib"; +import source C from "lib";`, + }, + { + name: "case sensitive bindings", + content: `import { D, b } from "a"; +import "B"; +import source a from "lib"; +import source C from "lib";`, + expected: `import { D, b } from "a"; +import "B"; +import source C from "lib"; +import source a from "lib";`, + }, + { + name: "no named imports", + content: `import source a from "lib"; +import source B from "lib";`, + expected: `import source B from "lib"; +import source a from "lib";`, + }, + { + name: "mixed import kinds", + content: `import { n } from "lib"; +` + imports + `import * as o from "lib"; +import type { T } from "lib";`, + expected: `import type { T } from "lib"; +import * as o from "lib"; +` + imports + `import { n } from "lib";`, + }, + } { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, test.content) + defer done() + f.VerifyOrganizeImports(t, test.expected+"\n", lsproto.CodeActionKindSourceSortImportsTs, &lsutil.UserPreferences{OrganizeImportsSort: lsutil.OrganizeImportsSortAuto}) + }) + } +} diff --git a/tsc/internal/fourslash/tests/referencesImportSource2_test.go b/tsc/internal/fourslash/tests/referencesImportSource2_test.go new file mode 100644 index 0000000000000..95f442b1d78fb --- /dev/null +++ b/tsc/internal/fourslash/tests/referencesImportSource2_test.go @@ -0,0 +1,33 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/TypeScript/tsc/internal/fourslash" + "github.com/microsoft/TypeScript/tsc/internal/testutil" +) + +func TestReferencesImportSource2(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @target: esnext +// @allowJs: true + +// @filename: /a.js +export default function /*a*/f() {} + +// @filename: /b.ts +import /*b*/f from "./a.js"; +f(); + +// @filename: /c.ts +import source /*c*/f from "/*module*/./a.js"; +f; +import.source("./a.js");` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyNoErrors(t) + f.VerifyBaselineFindAllReferences(t, "a", "b", "c", "module") + f.VerifyBaselineRename(t, nil /*preferences*/, "a", "b", "c") +} diff --git a/tsc/internal/fourslash/tests/referencesImportSource_test.go b/tsc/internal/fourslash/tests/referencesImportSource_test.go new file mode 100644 index 0000000000000..801040d55fcd7 --- /dev/null +++ b/tsc/internal/fourslash/tests/referencesImportSource_test.go @@ -0,0 +1,43 @@ +package fourslash_test + +import ( + "testing" + + "github.com/microsoft/TypeScript/tsc/internal/fourslash" + "github.com/microsoft/TypeScript/tsc/internal/testutil" +) + +func TestReferencesImportSource(t *testing.T) { + t.Parallel() + defer testutil.RecoverAndFail(t, "Panic on fourslash test") + const content = `// @module: esnext +// @target: esnext + +// @filename: /a.d.ts +declare module "m" { + export default function /*a*/f(): void; +} + +// @filename: /b.ts +import /*b*/f from "m"; +/*bUse*/f(); + +// @filename: /c.ts +import source /*c*/f from "m"; +/*cUse*/f; +export { f }; + +// @filename: /d.ts +import { /*d*/f } from "./c"; +/*dUse*/f; + +// @filename: /e.ts +import source /*e*/g from "m"; +/*eUse*/g; +import.source("m");` + f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) + defer done() + f.VerifyNoErrors(t) + f.VerifyBaselineFindAllReferences(t, "a", "b", "c", "cUse", "d", "e") + f.VerifyBaselineRename(t, nil /*preferences*/, "a", "b", "c", "cUse", "d", "e") +} diff --git a/tsc/internal/ls/autoimport/fix.go b/tsc/internal/ls/autoimport/fix.go index 46423f35f8e3e..d0a4dcb4ed9a8 100644 --- a/tsc/internal/ls/autoimport/fix.go +++ b/tsc/internal/ls/autoimport/fix.go @@ -748,6 +748,9 @@ func (v *View) tryAddToExistingImport( continue } importClause := importClauseNode.AsImportClause() + if importClause.PhaseModifier == ast.KindSourceKeyword { + continue + } namedBindings := importClause.NamedBindings // A type-only import may not have both a default and named imports, so the only way a name can diff --git a/tsc/internal/ls/organizeimports.go b/tsc/internal/ls/organizeimports.go index cea586875facd..0a4b4e2125abe 100644 --- a/tsc/internal/ls/organizeimports.go +++ b/tsc/internal/ls/organizeimports.go @@ -171,7 +171,7 @@ func organizeImportsWorker( for _, importGroup := range grouped { coalesced := coalesceImportsWorker(importGroup, comparer.moduleSpecifierComparer, specifierComparer, sourceFile, changeTracker) if shouldSort { - slices.SortFunc(coalesced, func(a, b *ast.Statement) int { + slices.SortStableFunc(coalesced, func(a, b *ast.Statement) int { return lsutil.CompareImportsOrRequireStatements(a, b, comparer.moduleSpecifierComparer) }) } @@ -473,6 +473,21 @@ func coalesceImportsWorker( if categorized.importWithoutClause != nil { coalescedImports = append(coalescedImports, categorized.importWithoutClause) } + slices.SortStableFunc(categorized.sourcePhaseImports, func(a, b *ast.Statement) int { + a = a.AsImportDeclaration().ImportClause + b = b.AsImportDeclaration().ImportClause + if a.Name() == nil && b.Name() == nil { + return 0 + } + if a.Name() == nil { + return 1 + } + if b.Name() == nil { + return -1 + } + return specifierComparer(a, b) + }) + coalescedImports = append(coalescedImports, categorized.sourcePhaseImports...) factory := ast.NewNodeFactory(ast.NodeFactoryHooks{}) @@ -634,6 +649,7 @@ func coalesceImportsWorker( type categorizedImports struct { importWithoutClause *ast.Statement + sourcePhaseImports []*ast.Statement typeOnlyImports importGroup regularImports importGroup } @@ -650,6 +666,7 @@ func (g importGroup) isEmpty() bool { func getCategorizedImports(importDecls []*ast.Statement) categorizedImports { var importWithoutClause *ast.Statement + var sourcePhaseImports []*ast.Statement var typeOnlyImports, regularImports importGroup for _, importDecl := range importDecls { @@ -661,6 +678,10 @@ func getCategorizedImports(importDecls []*ast.Statement) categorizedImports { } clause := importDecl.AsImportDeclaration().ImportClause.AsImportClause() + if clause.PhaseModifier == ast.KindSourceKeyword { + sourcePhaseImports = append(sourcePhaseImports, importDecl) + continue + } group := ®ularImports if clause.IsTypeOnly() { group = &typeOnlyImports @@ -685,6 +706,7 @@ func getCategorizedImports(importDecls []*ast.Statement) categorizedImports { return categorizedImports{ importWithoutClause: importWithoutClause, + sourcePhaseImports: sourcePhaseImports, typeOnlyImports: typeOnlyImports, regularImports: regularImports, } diff --git a/tsc/internal/ls/sourcedefinition.go b/tsc/internal/ls/sourcedefinition.go index 0a8024aa644f2..ee3547a34016d 100644 --- a/tsc/internal/ls/sourcedefinition.go +++ b/tsc/internal/ls/sourcedefinition.go @@ -67,9 +67,13 @@ func (l *LanguageService) provideSourceDefinitionAtPosition( originSelectionRange, _ := l.createLspRangeFromNode(node, file) + containingModuleSpecifier := findContainingModuleSpecifier(node) + if containingModuleSpecifier != nil && ast.IsSourcePhaseImport(containingModuleSpecifier.Parent) { + return l.provideDefinitionAtPosition(ctx, program, file, textPos, clientSupportsLink), nil + } + // If the cursor is directly on a module specifier string, resolve to the // implementation file's entry point. - containingModuleSpecifier := findContainingModuleSpecifier(node) if node == containingModuleSpecifier { specifierMode := program.GetModeForUsageLocation(file, containingModuleSpecifier) if implementationFile := resolver.resolveImplementation(containingModuleSpecifier.Text(), specifierMode); implementationFile != "" { diff --git a/tsc/internal/parser/parser.go b/tsc/internal/parser/parser.go index 1d149790b7565..c661576e31244 100644 --- a/tsc/internal/parser/parser.go +++ b/tsc/internal/parser/parser.go @@ -2285,6 +2285,7 @@ func (p *Parser) parseImportDeclarationOrImportEqualsDeclaration(pos int, jsdoc afterImportPos := p.nodePos() // We don't parse the identifier here in await context, instead we will report a grammar error in the checker. saveHasAwaitIdentifier := p.statementHasAwaitIdentifier + phaseModifierCandidate := p.currentImportPhaseModifier() var identifier *ast.Node if p.isIdentifier() { identifier = p.parseIdentifier() @@ -2298,22 +2299,14 @@ func (p *Parser) parseImportDeclarationOrImportEqualsDeclaration(pos int, jsdoc if p.isIdentifier() { identifier = p.parseIdentifier() } - } else if identifier != nil && identifier.Text() == "defer" { - var shouldParseAsDeferModifier bool - if p.token == ast.KindFromKeyword { - shouldParseAsDeferModifier = !p.lookAhead((*Parser).nextTokenIsTokenStringLiteral) - } else { - shouldParseAsDeferModifier = p.token != ast.KindCommaToken && p.token != ast.KindEqualsToken - } - if shouldParseAsDeferModifier { - phaseModifier = ast.KindDeferKeyword - identifier = nil - if p.isIdentifier() { - identifier = p.parseIdentifier() - } + } else if identifier != nil && phaseModifierCandidate != ast.KindUnknown && p.shouldParseImportPhaseModifier() { + phaseModifier = phaseModifierCandidate + identifier = nil + if p.isIdentifier() { + identifier = p.parseIdentifier() } } - if identifier != nil && !p.tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() && phaseModifier != ast.KindDeferKeyword { + if identifier != nil && p.tokenAfterImportedIdentifierAllowsImportEqualsDeclaration() && phaseModifier != ast.KindDeferKeyword && phaseModifier != ast.KindSourceKeyword { importEquals := p.checkJSSyntax(p.parseImportEqualsDeclaration(pos, jsdoc, modifiers, identifier, phaseModifier == ast.KindTypeKeyword)) p.statementHasAwaitIdentifier = saveHasAwaitIdentifier // Import= declaration is always parsed in an Await context, no need to reparse return importEquals @@ -2334,14 +2327,40 @@ func (p *Parser) nextTokenIsFromKeywordOrEqualsToken() bool { return p.token == ast.KindFromKeyword || p.token == ast.KindEqualsToken } +func (p *Parser) shouldParseImportPhaseModifier() bool { + switch p.token { + case ast.KindCommaToken, ast.KindEqualsToken: + return false + case ast.KindFromKeyword: + if p.lookAhead((*Parser).nextTokenIsTokenStringLiteral) { + return false + } + } + return true +} + +func (p *Parser) currentImportPhaseModifier() ast.Kind { + switch p.scanner.TokenText() { + case "defer": + return ast.KindDeferKeyword + case "source": + return ast.KindSourceKeyword + default: + return ast.KindUnknown + } +} + func (p *Parser) tokenAfterImportDefinitelyProducesImportDeclaration() bool { return p.token == ast.KindAsteriskToken || p.token == ast.KindOpenBraceToken } -func (p *Parser) tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() bool { - // In `import id ___`, the current token decides whether to produce - // an ImportDeclaration or ImportEqualsDeclaration. - return p.token == ast.KindCommaToken || p.token == ast.KindFromKeyword +func (p *Parser) tokenAfterImportedIdentifierAllowsImportEqualsDeclaration() bool { + switch p.token { + case ast.KindCommaToken, ast.KindFromKeyword: + return false + default: + return true + } } func (p *Parser) parseImportEqualsDeclaration(pos int, jsdoc jsdocScannerInfo, modifiers *ast.ModifierList, identifier *ast.Node, isTypeOnly bool) *ast.Node { @@ -2391,6 +2410,9 @@ func (p *Parser) tryParseImportClause(identifier *ast.Node, pos int, phaseModifi p.parseExpected(ast.KindFromKeyword) return importClause } + if phaseModifier == ast.KindSourceKeyword { + return p.finishNode(p.factory.NewImportClause(phaseModifier, nil /*name*/, nil /*namedBindings*/), pos) + } return nil } @@ -5245,8 +5267,8 @@ func (p *Parser) parseLeftHandSideExpressionOrHigher() *ast.Expression { // This is an 'import.*' metaproperty (i.e. 'import.meta') p.nextToken() // advance past the 'import' p.nextToken() // advance past the dot - expression = p.finishNode(p.factory.NewMetaProperty(ast.KindImportKeyword, p.parseIdentifierName()), pos) - if expression.Text() == "defer" { + expression = p.finishNode(p.factory.NewMetaProperty(ast.KindImportKeyword, p.parseImportMetaPropertyName()), pos) + if ast.IsImportPhaseMetaProperty(expression) { if p.token == ast.KindOpenParenToken || p.token == ast.KindLessThanToken { p.sourceFlags |= ast.NodeFlagsPossiblyContainsDynamicImport } @@ -5271,6 +5293,16 @@ func (p *Parser) nextTokenIsDot() bool { return p.nextToken() == ast.KindDotToken } +func (p *Parser) parseImportMetaPropertyName() *ast.Node { + switch p.token { + case ast.KindDeferKeyword, ast.KindSourceKeyword: + if p.currentImportPhaseModifier() == ast.KindUnknown { + p.parseErrorAtCurrentToken(diagnostics.Keywords_cannot_contain_escape_characters) + } + } + return p.parseIdentifierName() +} + func (p *Parser) parseSuperExpression() *ast.Expression { pos := p.nodePos() expression := p.parseKeywordExpression() @@ -6108,7 +6140,7 @@ func (p *Parser) isStartOfStatement() bool { case ast.KindConstKeyword, ast.KindExportKeyword: return p.isStartOfDeclaration() case ast.KindAsyncKeyword, ast.KindDeclareKeyword, ast.KindInterfaceKeyword, ast.KindModuleKeyword, ast.KindNamespaceKeyword, - ast.KindTypeKeyword, ast.KindGlobalKeyword, ast.KindDeferKeyword: + ast.KindTypeKeyword, ast.KindGlobalKeyword, ast.KindDeferKeyword, ast.KindSourceKeyword: // When these don't start a declaration, they're an identifier in an expression statement return true case ast.KindAccessorKeyword, ast.KindPublicKeyword, ast.KindPrivateKeyword, ast.KindProtectedKeyword, ast.KindStaticKeyword, @@ -6157,7 +6189,7 @@ func (p *Parser) scanStartOfDeclaration() bool { // I {} // // could be legal, it would add complexity for very little gain. - case ast.KindInterfaceKeyword, ast.KindTypeKeyword, ast.KindDeferKeyword: + case ast.KindInterfaceKeyword, ast.KindTypeKeyword, ast.KindDeferKeyword, ast.KindSourceKeyword: return p.nextTokenIsIdentifierOnSameLine() case ast.KindModuleKeyword, ast.KindNamespaceKeyword: return p.nextTokenIsIdentifierOrStringLiteralOnSameLine() @@ -6180,7 +6212,7 @@ func (p *Parser) scanStartOfDeclaration() bool { return p.token == ast.KindOpenBraceToken || p.token == ast.KindIdentifier || p.token == ast.KindExportKeyword case ast.KindImportKeyword: p.nextToken() - return p.token == ast.KindDeferKeyword || p.token == ast.KindStringLiteral || p.token == ast.KindAsteriskToken || p.token == ast.KindOpenBraceToken || tokenIsIdentifierOrKeyword(p.token) + return p.token == ast.KindDeferKeyword || p.token == ast.KindSourceKeyword || p.token == ast.KindStringLiteral || p.token == ast.KindAsteriskToken || p.token == ast.KindOpenBraceToken || tokenIsIdentifierOrKeyword(p.token) case ast.KindExportKeyword: p.nextToken() if p.token == ast.KindEqualsToken || p.token == ast.KindAsteriskToken || p.token == ast.KindOpenBraceToken || diff --git a/tsc/internal/parser/parser_test.go b/tsc/internal/parser/parser_test.go index 200064160228b..bd5a57e535b50 100644 --- a/tsc/internal/parser/parser_test.go +++ b/tsc/internal/parser/parser_test.go @@ -11,11 +11,13 @@ import ( "github.com/microsoft/TypeScript/tsc/internal/ast" "github.com/microsoft/TypeScript/tsc/internal/collections" "github.com/microsoft/TypeScript/tsc/internal/core" + "github.com/microsoft/TypeScript/tsc/internal/diagnostics" "github.com/microsoft/TypeScript/tsc/internal/parser" "github.com/microsoft/TypeScript/tsc/internal/repo" "github.com/microsoft/TypeScript/tsc/internal/scanner" "github.com/microsoft/TypeScript/tsc/internal/testrunner" "github.com/microsoft/TypeScript/tsc/internal/testutil/fixtures" + "github.com/microsoft/TypeScript/tsc/internal/testutil/parsetestutil" "github.com/microsoft/TypeScript/tsc/internal/tspath" "github.com/microsoft/TypeScript/tsc/internal/vfs/osvfs" "gotest.tools/v3/assert" @@ -186,6 +188,183 @@ class MissingImplements implements B. {} assert.Equal(t, missingImplementsDecl.HeritageClauses.Nodes[0].AsHeritageClause().Types.Nodes[0].Kind, ast.KindExpressionWithTypeArguments) } +func TestParseStaticSourcePhaseImport(t *testing.T) { + t.Parallel() + tests := []struct { + name string + source string + phaseModifier ast.Kind + bindingName string + hasAttributes bool + }{ + { + name: "source phase", + source: `import source a from "./a.wasm";`, + phaseModifier: ast.KindSourceKeyword, + bindingName: "a", + }, + { + name: "source phase with import attributes", + source: `import source a from "./a.wasm" with { type: "webassembly" };`, + phaseModifier: ast.KindSourceKeyword, + bindingName: "a", + hasAttributes: true, + }, + { + name: "from as source phase binding", + source: `import source from from "./module.js";`, + phaseModifier: ast.KindSourceKeyword, + bindingName: "from", + }, + { + name: "source as ordinary default binding", + source: `import source from "./module.js";`, + phaseModifier: ast.KindUnknown, + bindingName: "source", + }, + { + name: "source as ordinary default binding with named imports", + source: `import source, { value } from "./module.js";`, + phaseModifier: ast.KindUnknown, + bindingName: "source", + }, + { + name: "escaped source as ordinary default binding", + source: `import s\u006furce from "./module.js";`, + phaseModifier: ast.KindUnknown, + bindingName: "source", + }, + { + name: "escaped defer as ordinary default binding", + source: `import d\u0065fer from "./module.js";`, + phaseModifier: ast.KindUnknown, + bindingName: "defer", + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Parallel() + file := parsetestutil.ParseTypeScript(test.source, false) + parsetestutil.CheckDiagnostics(t, file) + assert.Equal(t, len(file.Statements.Nodes), 1) + + statement := file.Statements.Nodes[0] + assert.Assert(t, ast.IsImportDeclaration(statement)) + + declaration := statement.AsImportDeclaration() + assert.Assert(t, declaration.ImportClause != nil) + + clause := declaration.ImportClause.AsImportClause() + assert.Equal(t, clause.PhaseModifier, test.phaseModifier) + assert.Assert(t, clause.Name() != nil) + assert.Equal(t, clause.Name().Text(), test.bindingName) + assert.Equal(t, declaration.Attributes != nil, test.hasAttributes) + }) + } +} + +func TestParseSourceAsImportEqualsBinding(t *testing.T) { + t.Parallel() + file := parsetestutil.ParseTypeScript(`import source = require("./module.js");`, false) + parsetestutil.CheckDiagnostics(t, file) + assert.Equal(t, len(file.Statements.Nodes), 1) + + statement := file.Statements.Nodes[0] + assert.Assert(t, ast.IsImportEqualsDeclaration(statement)) + + assert.Equal(t, statement.Name().Text(), "source") +} + +func TestParseInvalidStaticSourcePhaseImports(t *testing.T) { + t.Parallel() + tests := []struct { + source string + hasName bool + hasNamedBindings bool + }{ + {source: `import source "./a.js";`}, + {source: `import source * as a from "./a.js";`, hasNamedBindings: true}, + {source: `import source { a } from "./a.js";`, hasNamedBindings: true}, + {source: `import source a, { b } from "./a.js";`, hasName: true, hasNamedBindings: true}, + } + + for _, test := range tests { + file := parsetestutil.ParseTypeScript(test.source, false) + parsetestutil.CheckDiagnostics(t, file) + assert.Equal(t, len(file.Statements.Nodes), 1) + + statement := file.Statements.Nodes[0] + assert.Assert(t, ast.IsImportDeclaration(statement)) + + declaration := statement.AsImportDeclaration() + assert.Assert(t, declaration.ImportClause != nil) + + clause := declaration.ImportClause.AsImportClause() + assert.Equal(t, clause.PhaseModifier, ast.KindSourceKeyword) + assert.Equal(t, clause.Name() != nil, test.hasName) + assert.Equal(t, clause.NamedBindings != nil, test.hasNamedBindings) + } +} + +func TestParseDynamicSourcePhaseImport(t *testing.T) { + t.Parallel() + file := parsetestutil.ParseTypeScript(`import.source("./a.wasm", { with: { type: "webassembly" } });`, false) + parsetestutil.CheckDiagnostics(t, file) + assert.Equal(t, len(file.Statements.Nodes), 1) + + statement := file.Statements.Nodes[0] + assert.Assert(t, ast.IsExpressionStatement(statement)) + + call := statement.AsExpressionStatement().Expression + assert.Assert(t, ast.IsCallExpression(call)) + assert.Assert(t, ast.IsImportCall(call)) + assert.Assert(t, call.SubtreeFacts()&ast.SubtreeContainsDynamicImport != 0) + + metaProperty := call.Expression() + assert.Assert(t, ast.IsMetaProperty(metaProperty)) + assert.Equal(t, metaProperty.AsMetaProperty().KeywordToken, ast.KindImportKeyword) + assert.Equal(t, metaProperty.Text(), "source") + assert.Equal(t, len(call.Arguments()), 2) + assert.Equal(t, file.Flags&ast.NodeFlagsPossiblyContainsDynamicImport != 0, true) + assert.Equal(t, file.Flags&ast.NodeFlagsPossiblyContainsImportMeta != 0, false) + assert.Equal(t, file.ExternalModuleIndicator == nil, true) +} + +func TestParseEscapedDynamicImportPhase(t *testing.T) { + t.Parallel() + tests := []struct { + source string + phaseName string + }{ + {source: `import.d\u0065fer("./a.js");`, phaseName: "defer"}, + {source: `import.s\u006furce("./a.wasm");`, phaseName: "source"}, + } + + for _, test := range tests { + t.Run(test.phaseName, func(t *testing.T) { + t.Parallel() + file := parsetestutil.ParseTypeScript(test.source, false) + assert.Equal(t, len(file.Diagnostics()), 1) + assert.Equal(t, file.Diagnostics()[0].Code(), diagnostics.Keywords_cannot_contain_escape_characters.Code()) + assert.Equal(t, len(file.Statements.Nodes), 1) + + statement := file.Statements.Nodes[0] + assert.Assert(t, ast.IsExpressionStatement(statement)) + + call := statement.AsExpressionStatement().Expression + assert.Assert(t, ast.IsCallExpression(call)) + assert.Assert(t, ast.IsImportCall(call)) + + metaProperty := call.Expression() + assert.Assert(t, ast.IsMetaProperty(metaProperty)) + assert.Equal(t, metaProperty.Text(), test.phaseName) + assert.Equal(t, file.Flags&ast.NodeFlagsPossiblyContainsDynamicImport != 0, true) + assert.Equal(t, file.Flags&ast.NodeFlagsPossiblyContainsImportMeta != 0, false) + }) + } +} + func TestJSDocImportTypeParentChain(t *testing.T) { t.Parallel() sourceText := `test("", async function () { diff --git a/tsc/internal/printer/printer.go b/tsc/internal/printer/printer.go index 51673e4afd02e..71d2acbf30081 100644 --- a/tsc/internal/printer/printer.go +++ b/tsc/internal/printer/printer.go @@ -3014,8 +3014,8 @@ func (p *Printer) emitNonNullExpression(node *ast.NonNullExpression) { func (p *Printer) emitMetaProperty(node *ast.MetaProperty) { state := p.enterNode(node.AsNode()) - p.emitToken(node.KeywordToken, node.Pos(), WriteKindPunctuation, node.AsNode()) - p.writePunctuation(".") + pos := p.emitToken(node.KeywordToken, node.Pos(), WriteKindPunctuation, node.AsNode()) + p.emitToken(ast.KindDotToken, pos, WriteKindPunctuation, node.AsNode()) p.emitIdentifierName(node.Name().AsIdentifier()) p.exitNode(node.AsNode(), state) } diff --git a/tsc/internal/scanner/scanner.go b/tsc/internal/scanner/scanner.go index 55c81643836bc..785fe50a4e7df 100644 --- a/tsc/internal/scanner/scanner.go +++ b/tsc/internal/scanner/scanner.go @@ -104,6 +104,7 @@ var textToKeyword = map[string]ast.Kind{ "return": ast.KindReturnKeyword, "satisfies": ast.KindSatisfiesKeyword, "set": ast.KindSetKeyword, + "source": ast.KindSourceKeyword, "static": ast.KindStaticKeyword, "string": ast.KindStringKeyword, "super": ast.KindSuperKeyword, diff --git a/tsc/internal/scanner/scanner_test.go b/tsc/internal/scanner/scanner_test.go index 5c50a17fe0f59..8f970f2af8467 100644 --- a/tsc/internal/scanner/scanner_test.go +++ b/tsc/internal/scanner/scanner_test.go @@ -91,3 +91,15 @@ func TestGetTextOfNodeFromJSDocTypePreservesAsteriskType(t *testing.T) { assert.Equal(t, GetTextOfNodeFromSourceText(sourceText, node, false /*includeTrivia*/), "*") } + +func TestScanSourceKeyword(t *testing.T) { + t.Parallel() + s := NewScanner() + s.SetText("source sourceValue") + + assert.Equal(t, s.Scan(), ast.KindSourceKeyword) + assert.Equal(t, TokenToString(ast.KindSourceKeyword), "source") + assert.Equal(t, StringToToken("source"), ast.KindSourceKeyword) + assert.Equal(t, s.Scan(), ast.KindIdentifier) + assert.Equal(t, s.TokenValue(), "sourceValue") +} diff --git a/tsc/internal/transformers/moduletransforms/commonjsmodule.go b/tsc/internal/transformers/moduletransforms/commonjsmodule.go index cae5a208d0b55..94a2c244f145b 100644 --- a/tsc/internal/transformers/moduletransforms/commonjsmodule.go +++ b/tsc/internal/transformers/moduletransforms/commonjsmodule.go @@ -1811,7 +1811,7 @@ func (tx *CommonJSModuleTransformer) visitCallExpression(node *ast.CallExpressio needsRewrite = true } } - if ast.IsImportCall(node.AsNode()) && tx.shouldTransformImportCall() { + if node.Expression.Kind == ast.KindImportKeyword && tx.shouldTransformImportCall() { return tx.visitImportCallExpression(node, needsRewrite) } if needsRewrite { diff --git a/tsc/internal/tsoptions/declarations_generated.go b/tsc/internal/tsoptions/declarations_generated.go index 49e185fdb8b30..977a0fc547dab 100644 --- a/tsc/internal/tsoptions/declarations_generated.go +++ b/tsc/internal/tsoptions/declarations_generated.go @@ -1262,6 +1262,7 @@ var LibMap = collections.NewOrderedMapFromList([]collections.MapEntry[string, an {Key: "esnext.decorators", Value: "lib.esnext.decorators.d.ts"}, {Key: "esnext.disposable", Value: "lib.esnext.disposable.d.ts"}, {Key: "esnext.intl", Value: "lib.esnext.intl.d.ts"}, + {Key: "esnext.modulesource", Value: "lib.esnext.modulesource.d.ts"}, {Key: "esnext.sharedmemory", Value: "lib.esnext.sharedmemory.d.ts"}, {Key: "esnext.temporal", Value: "lib.esnext.temporal.d.ts"}, {Key: "decorators", Value: "lib.decorators.d.ts"}, diff --git a/tsc/testdata/baselines/reference/compiler/libReplacement(libreplacement=true).trace.json b/tsc/testdata/baselines/reference/compiler/libReplacement(libreplacement=true).trace.json index a929c4dc208b9..e78ca384a0ee0 100644 --- a/tsc/testdata/baselines/reference/compiler/libReplacement(libreplacement=true).trace.json +++ b/tsc/testdata/baselines/reference/compiler/libReplacement(libreplacement=true).trace.json @@ -1155,6 +1155,19 @@ Searching all ancestor node_modules directories for fallback extensions: JavaScr Directory '/.src/node_modules' does not exist, skipping all lookups in it. Directory '/node_modules' does not exist, skipping all lookups in it. ======== Module name '@typescript/lib-esnext/intl' was not resolved. ======== +======== Resolving module '@typescript/lib-esnext/modulesource' from '/.src/__lib_node_modules_lookup_lib.esnext.modulesource.d.ts__.ts'. ======== +Module resolution kind is not specified, using 'Bundler'. +Resolving in CJS mode with conditions 'require', 'types'. +File '/.src/package.json' does not exist according to earlier cached lookups. +File '/package.json' does not exist according to earlier cached lookups. +Loading module '@typescript/lib-esnext/modulesource' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Directory '/.src/node_modules' does not exist, skipping all lookups in it. +Directory '/node_modules' does not exist, skipping all lookups in it. +Searching all ancestor node_modules directories for fallback extensions: JavaScript, JSON. +Directory '/.src/node_modules' does not exist, skipping all lookups in it. +Directory '/node_modules' does not exist, skipping all lookups in it. +======== Module name '@typescript/lib-esnext/modulesource' was not resolved. ======== ======== Resolving module '@typescript/lib-esnext/promise' from '/.src/__lib_node_modules_lookup_lib.esnext.promise.d.ts__.ts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. diff --git a/tsc/testdata/baselines/reference/conformance/importMetaPropertyInvalidInCall.errors.txt b/tsc/testdata/baselines/reference/conformance/importMetaPropertyInvalidInCall.errors.txt index 6ab3da50174a8..aa44dccdf444b 100644 --- a/tsc/testdata/baselines/reference/conformance/importMetaPropertyInvalidInCall.errors.txt +++ b/tsc/testdata/baselines/reference/conformance/importMetaPropertyInvalidInCall.errors.txt @@ -1,11 +1,11 @@ -b.ts(1,8): error TS18061: 'foo' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'? +b.ts(1,8): error TS18061: 'foo' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'? b.ts(2,8): error TS17012: 'foo' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== b.ts (2 errors) ==== import.foo(); ~~~ -!!! error TS18061: 'foo' is not a valid meta-property for keyword 'import'. Did you mean 'meta' or 'defer'? +!!! error TS18061: 'foo' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'? import.foo; ~~~ !!! error TS17012: 'foo' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? diff --git a/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).js b/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).js new file mode 100644 index 0000000000000..dfd2d8774fb17 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/importSource/importSource1.ts] //// + +//// [b.ts] +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; + +//// [c.ts] +import source a from "./a.wasm" with { type: "webassembly" }; +const b: AbstractModuleSource = a; + + +//// [b.js] +import source a from "./a.wasm"; +const b = a; +//// [c.js] +import source a from "./a.wasm" with { type: "webassembly" }; +const b = a; diff --git a/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).symbols b/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).symbols new file mode 100644 index 0000000000000..83f1934b705b3 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource1.ts] //// + +=== b.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(b.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(b.ts, 0, 6)) + +=== c.ts === +import source a from "./a.wasm" with { type: "webassembly" }; +>a : Symbol(a, Decl(c.ts, 0, 6)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(c.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(c.ts, 0, 6)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).types b/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).types new file mode 100644 index 0000000000000..daf7d047c7a3f --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource1(module=esnext).types @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/importSource/importSource1.ts] //// + +=== b.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +=== c.ts === +import source a from "./a.wasm" with { type: "webassembly" }; +>a : AbstractModuleSource +>type : error + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + diff --git a/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).js b/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).js new file mode 100644 index 0000000000000..dfd2d8774fb17 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/importSource/importSource1.ts] //// + +//// [b.ts] +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; + +//// [c.ts] +import source a from "./a.wasm" with { type: "webassembly" }; +const b: AbstractModuleSource = a; + + +//// [b.js] +import source a from "./a.wasm"; +const b = a; +//// [c.js] +import source a from "./a.wasm" with { type: "webassembly" }; +const b = a; diff --git a/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).symbols b/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).symbols new file mode 100644 index 0000000000000..83f1934b705b3 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource1.ts] //// + +=== b.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(b.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(b.ts, 0, 6)) + +=== c.ts === +import source a from "./a.wasm" with { type: "webassembly" }; +>a : Symbol(a, Decl(c.ts, 0, 6)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(c.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(c.ts, 0, 6)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).types b/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).types new file mode 100644 index 0000000000000..daf7d047c7a3f --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource1(module=preserve).types @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/importSource/importSource1.ts] //// + +=== b.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +=== c.ts === +import source a from "./a.wasm" with { type: "webassembly" }; +>a : AbstractModuleSource +>type : error + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + diff --git a/tsc/testdata/baselines/reference/conformance/importSource10.js b/tsc/testdata/baselines/reference/conformance/importSource10.js new file mode 100644 index 0000000000000..3de3d598d13cb --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource10.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/importSource/importSource10.ts] //// + +//// [a.ts] +export {}; + +//// [b.ts] +import source a from "./a.ts"; +export { a }; +export const b = import.source("./a.ts"); + + +//// [a.js] +//// [b.js] +import source a from "./a.js"; +export { a }; +export const b = import.source("./a.js"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource10.symbols b/tsc/testdata/baselines/reference/conformance/importSource10.symbols new file mode 100644 index 0000000000000..10b5460160de6 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource10.symbols @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/importSource/importSource10.ts] //// + +=== a.ts === + +export {}; + +=== b.ts === +import source a from "./a.ts"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + +export { a }; +>a : Symbol(a, Decl(b.ts, 1, 8)) + +export const b = import.source("./a.ts"); +>b : Symbol(b, Decl(b.ts, 2, 12)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource10.types b/tsc/testdata/baselines/reference/conformance/importSource10.types new file mode 100644 index 0000000000000..21648fd40951d --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource10.types @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/importSource/importSource10.ts] //// + +=== a.ts === + +export {}; + +=== b.ts === +import source a from "./a.ts"; +>a : AbstractModuleSource + +export { a }; +>a : AbstractModuleSource + +export const b = import.source("./a.ts"); +>b : Promise +>import.source("./a.ts") : Promise +>source : any +>"./a.ts" : "./a.ts" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource11.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource11.errors.txt new file mode 100644 index 0000000000000..d0cd14298f9a7 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource11.errors.txt @@ -0,0 +1,107 @@ +b.js(1,8): error TS18112: Named and namespace imports are not allowed in a source phase import. +c.js(1,8): error TS18112: Named and namespace imports are not allowed in a source phase import. +d.js(1,8): error TS18112: Named and namespace imports are not allowed in a source phase import. +e.js(1,8): error TS18111: A source phase import must specify a local binding. +f.js(1,14): error TS1005: '(' expected. +f.js(2,15): error TS1005: '(' expected. +f.js(3,23): error TS1005: '(' expected. +f.js(4,14): error TS1005: '(' expected. +f.js(6,1): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +f.js(7,1): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +f.js(8,14): error TS18114: Optional chaining cannot be used with 'import.source'. +f.js(9,14): error TS1005: '(' expected. +f.js(10,15): error TS1325: Argument of dynamic import cannot be spread element. +g.js(1,5): error TS1109: Expression expected. +h.js(1,21): error TS1005: '(' expected. +i.js(1,8): error TS18061: 'a' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'? +m.js(1,8): error TS1260: Keywords cannot contain escape characters. + + +==== a.js (0 errors) ==== + export default 1; + export const a = 2; + +==== b.js (1 errors) ==== + import source * as a from "./a.js"; + ~~~~~~~~~~~~~ +!!! error TS18112: Named and namespace imports are not allowed in a source phase import. + +==== c.js (1 errors) ==== + import source { a } from "./a.js"; + ~~~~~~~~~~~~ +!!! error TS18112: Named and namespace imports are not allowed in a source phase import. + +==== d.js (1 errors) ==== + import source a, { a as b } from "./a.js"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS18112: Named and namespace imports are not allowed in a source phase import. + +==== e.js (1 errors) ==== + import source "./a.js"; + ~~~~~~ +!!! error TS18111: A source phase import must specify a local binding. + +==== f.js (9 errors) ==== + import.source; + +!!! error TS1005: '(' expected. + (import.source)("./a.js"); + +!!! error TS1005: '(' expected. + Function(import.source); + +!!! error TS1005: '(' expected. + import.source.unknown; + +!!! error TS1005: '(' expected. + + import.source(); + ~~~~~~~~~~~~~~~ +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + import.source("./a.js", {}, {}); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + import.source?.("./a.js"); + ~~ +!!! error TS18114: Optional chaining cannot be used with 'import.source'. + import.source("./a.js"); + +!!! error TS1005: '(' expected. + import.source(...["./a.js"]); + ~~~~~~~~~~~~~ +!!! error TS1325: Argument of dynamic import cannot be spread element. + +==== g.js (1 errors) ==== + new import.source("./a.js"); + ~~~~~~ +!!! error TS1109: Expression expected. + +==== h.js (1 errors) ==== + typeof import.source; + +!!! error TS1005: '(' expected. + +==== i.js (1 errors) ==== + import.a("./a.js"); + ~ +!!! error TS18061: 'a' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'? + +==== j.js (0 errors) ==== + import source a from "./a.js" with { type: "javascript" }; + const b = import.source("./a.js", { with: { type: "javascript" } }); + a; + b; + +==== k.js (0 errors) ==== + const a = import.source("./a.js", { with: { type: "javascript" } }); + a; + +==== l.js (0 errors) ==== + import s\u006furce from "./a.js"; + source; + +==== m.js (1 errors) ==== + import.s\u006furce("./a.js"); + ~~~~~~~~~~~ +!!! error TS1260: Keywords cannot contain escape characters. + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource11.symbols b/tsc/testdata/baselines/reference/conformance/importSource11.symbols new file mode 100644 index 0000000000000..55118fe3781fe --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource11.symbols @@ -0,0 +1,85 @@ +//// [tests/cases/conformance/importSource/importSource11.ts] //// + +=== a.js === +export default 1; +export const a = 2; +>a : Symbol(a, Decl(a.js, 1, 12)) + +=== b.js === +import source * as a from "./a.js"; +>a : Symbol(a, Decl(b.js, 0, 13)) + +=== c.js === +import source { a } from "./a.js"; +>a : Symbol(a, Decl(c.js, 0, 15)) + +=== d.js === +import source a, { a as b } from "./a.js"; +>a : Symbol(a, Decl(d.js, 0, 6)) +>b : Symbol(b, Decl(d.js, 0, 18)) + +=== e.js === + +import source "./a.js"; + +=== f.js === +import.source; +(import.source)("./a.js"); +Function(import.source); +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) + +import.source.unknown; + +import.source(); +import.source("./a.js", {}, {}); +import.source?.("./a.js"); +import.source("./a.js"); +import.source(...["./a.js"]); + +=== g.js === + +new import.source("./a.js"); + +=== h.js === + +typeof import.source; + +=== i.js === + +import.a("./a.js"); + +=== j.js === +import source a from "./a.js" with { type: "javascript" }; +>a : Symbol(a, Decl(j.js, 0, 6)) + +const b = import.source("./a.js", { with: { type: "javascript" } }); +>b : Symbol(b, Decl(j.js, 1, 5)) +>with : Symbol(with, Decl(j.js, 1, 35)) +>type : Symbol(type, Decl(j.js, 1, 43)) + +a; +>a : Symbol(a, Decl(j.js, 0, 6)) + +b; +>b : Symbol(b, Decl(j.js, 1, 5)) + +=== k.js === +const a = import.source("./a.js", { with: { type: "javascript" } }); +>a : Symbol(a, Decl(k.js, 0, 5)) +>with : Symbol(with, Decl(k.js, 0, 35)) +>type : Symbol(type, Decl(k.js, 0, 43)) + +a; +>a : Symbol(a, Decl(k.js, 0, 5)) + +=== l.js === +import s\u006furce from "./a.js"; +>s\u006furce : Symbol(s\u006furce, Decl(l.js, 0, 6)) + +source; +>source : Symbol(s\u006furce, Decl(l.js, 0, 6)) + +=== m.js === + +import.s\u006furce("./a.js"); + diff --git a/tsc/testdata/baselines/reference/conformance/importSource11.types b/tsc/testdata/baselines/reference/conformance/importSource11.types new file mode 100644 index 0000000000000..8a806cfc79bad --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource11.types @@ -0,0 +1,153 @@ +//// [tests/cases/conformance/importSource/importSource11.ts] //// + +=== a.js === +export default 1; +export const a = 2; +>a : 2 +>2 : 2 + +=== b.js === +import source * as a from "./a.js"; +>a : any + +=== c.js === +import source { a } from "./a.js"; +>a : any + +=== d.js === +import source a, { a as b } from "./a.js"; +>a : AbstractModuleSource +>a : any +>b : any + +=== e.js === + +import source "./a.js"; + +=== f.js === +import.source; +>import.source : any +>source : any + +(import.source)("./a.js"); +>(import.source)("./a.js") : any +>(import.source) : any +>import.source : any +>source : any +>"./a.js" : "./a.js" + +Function(import.source); +>Function(import.source) : Function +>Function : FunctionConstructor +>import.source : any +>source : any + +import.source.unknown; +>import.source.unknown : any +>import.source : any +>source : any +>unknown : any + +import.source(); +>import.source() : Promise +>source : any + +import.source("./a.js", {}, {}); +>import.source("./a.js", {}, {}) : Promise +>source : any +>"./a.js" : "./a.js" +>{} : {} +>{} : {} + +import.source?.("./a.js"); +>import.source?.("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + +import.source("./a.js"); +>import.source("./a.js") : boolean +>import.sourceimport.source : any +>source : any +>string : any +>("./a.js") : "./a.js" +>"./a.js" : "./a.js" + +import.source(...["./a.js"]); +>import.source(...["./a.js"]) : Promise +>source : any +>...["./a.js"] : string +>["./a.js"] : [string] +>"./a.js" : "./a.js" + +=== g.js === +new import.source("./a.js"); +>new : any +> : any +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + +=== h.js === +typeof import.source; +>typeof import.source : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" +>import.source : any +>source : any + +=== i.js === +import.a("./a.js"); +>import.a("./a.js") : any +>import.a : any +>a : any +>"./a.js" : "./a.js" + +=== j.js === +import source a from "./a.js" with { type: "javascript" }; +>a : AbstractModuleSource +>type : any + +const b = import.source("./a.js", { with: { type: "javascript" } }); +>b : Promise +>import.source("./a.js", { with: { type: "javascript" } }) : Promise +>source : any +>"./a.js" : "./a.js" +>{ with: { type: "javascript" } } : { with: { readonly type: "javascript"; }; } +>with : { readonly type: "javascript"; } +>{ type: "javascript" } : { readonly type: "javascript"; } +>type : "javascript" +>"javascript" : "javascript" + +a; +>a : AbstractModuleSource + +b; +>b : Promise + +=== k.js === +const a = import.source("./a.js", { with: { type: "javascript" } }); +>a : Promise +>import.source("./a.js", { with: { type: "javascript" } }) : Promise +>source : any +>"./a.js" : "./a.js" +>{ with: { type: "javascript" } } : { with: { readonly type: "javascript"; }; } +>with : { readonly type: "javascript"; } +>{ type: "javascript" } : { readonly type: "javascript"; } +>type : "javascript" +>"javascript" : "javascript" + +a; +>a : Promise + +=== l.js === +import s\u006furce from "./a.js"; +>s\u006furce : 1 + +source; +>source : 1 + +=== m.js === +import.s\u006furce("./a.js"); +>import.s\u006furce("./a.js") : Promise +>s\u006furce : any +>"./a.js" : "./a.js" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource12.symbols b/tsc/testdata/baselines/reference/conformance/importSource12.symbols new file mode 100644 index 0000000000000..54100823b12ec --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource12.symbols @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/importSource/importSource12.ts] //// + +=== b.js === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(b.js, 0, 6)) + +const b = import.source("./a.wasm"); +>b : Symbol(b, Decl(b.js, 1, 5)) + +/** @type {AbstractModuleSource} */ +const c = a; +>c : Symbol(c, Decl(b.js, 4, 5)) +>a : Symbol(a, Decl(b.js, 0, 6)) + +/** @type {Promise} */ +const d = b; +>d : Symbol(d, Decl(b.js, 7, 5)) +>b : Symbol(b, Decl(b.js, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource12.types b/tsc/testdata/baselines/reference/conformance/importSource12.types new file mode 100644 index 0000000000000..8a6859a58f3e6 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource12.types @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/importSource/importSource12.ts] //// + +=== b.js === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +const b = import.source("./a.wasm"); +>b : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + +/** @type {AbstractModuleSource} */ +const c = a; +>c : AbstractModuleSource +>a : AbstractModuleSource + +/** @type {Promise} */ +const d = b; +>d : Promise +>b : Promise + diff --git a/tsc/testdata/baselines/reference/conformance/importSource13.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource13.errors.txt new file mode 100644 index 0000000000000..7169cf09e89a8 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource13.errors.txt @@ -0,0 +1,15 @@ +c.cts(1,8): error TS18115: Source phase imports are not allowed on statements that compile to CommonJS 'require' calls. + + +==== b.mts (0 errors) ==== + import source a from "./a.wasm"; + const b: AbstractModuleSource = a; + const c: Promise = import.source("./a.wasm"); + +==== c.cts (1 errors) ==== + import source a from "./a.wasm"; + ~~~~~~~~ +!!! error TS18115: Source phase imports are not allowed on statements that compile to CommonJS 'require' calls. + const b: AbstractModuleSource = a; + const c: Promise = import.source("./a.wasm"); + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource13.js b/tsc/testdata/baselines/reference/conformance/importSource13.js new file mode 100644 index 0000000000000..f9fa3c583a0a1 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource13.js @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/importSource/importSource13.ts] //// + +//// [b.mts] +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; +const c: Promise = import.source("./a.wasm"); + +//// [c.cts] +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; +const c: Promise = import.source("./a.wasm"); + + +//// [b.mjs] +import source a from "./a.wasm"; +const b = a; +const c = import.source("./a.wasm"); +//// [c.cjs] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const a_wasm_1 = __importDefault(require("./a.wasm")); +const b = a_wasm_1.default; +const c = import.source("./a.wasm"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource13.symbols b/tsc/testdata/baselines/reference/conformance/importSource13.symbols new file mode 100644 index 0000000000000..d956653ac0a06 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource13.symbols @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importSource/importSource13.ts] //// + +=== b.mts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(b.mts, 0, 6)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(b.mts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(b.mts, 0, 6)) + +const c: Promise = import.source("./a.wasm"); +>c : Symbol(c, Decl(b.mts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + +=== c.cts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(c.cts, 0, 6)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(c.cts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(c.cts, 0, 6)) + +const c: Promise = import.source("./a.wasm"); +>c : Symbol(c, Decl(c.cts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource13.types b/tsc/testdata/baselines/reference/conformance/importSource13.types new file mode 100644 index 0000000000000..0c46d26dc43ef --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource13.types @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/importSource/importSource13.ts] //// + +=== b.mts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +const c: Promise = import.source("./a.wasm"); +>c : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + +=== c.cts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +const c: Promise = import.source("./a.wasm"); +>c : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource14.js b/tsc/testdata/baselines/reference/conformance/importSource14.js new file mode 100644 index 0000000000000..559b3ac0fcfd3 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource14.js @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource14.ts] //// + +//// [package.json] +{"type":"commonjs"} + +//// [a.ts] +export {}; + +//// [b.cts] +export const a = import.source("./a.ts"); + + +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//// [b.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = import.source("./a.js"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource14.symbols b/tsc/testdata/baselines/reference/conformance/importSource14.symbols new file mode 100644 index 0000000000000..2286fe78c6b1d --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource14.symbols @@ -0,0 +1,10 @@ +//// [tests/cases/conformance/importSource/importSource14.ts] //// + +=== a.ts === + +export {}; + +=== b.cts === +export const a = import.source("./a.ts"); +>a : Symbol(a, Decl(b.cts, 0, 12)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource14.types b/tsc/testdata/baselines/reference/conformance/importSource14.types new file mode 100644 index 0000000000000..298a3367a0a0b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource14.types @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/importSource/importSource14.ts] //// + +=== a.ts === + +export {}; + +=== b.cts === +export const a = import.source("./a.ts"); +>a : Promise +>import.source("./a.ts") : Promise +>source : any +>"./a.ts" : "./a.ts" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).errors.txt b/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).errors.txt new file mode 100644 index 0000000000000..a4f102d0e3909 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).errors.txt @@ -0,0 +1,18 @@ +b.js(1,8): error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +b.js(2,11): error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. + + +==== package.json (0 errors) ==== + {"type":"commonjs"} + +==== a.js (0 errors) ==== + export default 1; + +==== b.js (2 errors) ==== + import source a from "./a.js"; + ~~~~~~~~ +!!! error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. + const b = import.source("./a.js"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).symbols b/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).symbols new file mode 100644 index 0000000000000..c2cc1fb8c36c4 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/importSource/importSource15.ts] //// + +=== a.js === + +export default 1; + +=== b.js === +import source a from "./a.js"; +>a : Symbol(a, Decl(b.js, 0, 6)) + +const b = import.source("./a.js"); +>b : Symbol(b, Decl(b.js, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).types b/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).types new file mode 100644 index 0000000000000..e19fadcaf9128 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource15(module=commonjs).types @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/importSource/importSource15.ts] //// + +=== a.js === + +export default 1; + +=== b.js === +import source a from "./a.js"; +>a : AbstractModuleSource + +const b = import.source("./a.js"); +>b : Promise +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).errors.txt b/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).errors.txt new file mode 100644 index 0000000000000..713c1677cbf0c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).errors.txt @@ -0,0 +1,15 @@ +b.js(1,8): error TS18115: Source phase imports are not allowed on statements that compile to CommonJS 'require' calls. + + +==== package.json (0 errors) ==== + {"type":"commonjs"} + +==== a.js (0 errors) ==== + export default 1; + +==== b.js (1 errors) ==== + import source a from "./a.js"; + ~~~~~~~~ +!!! error TS18115: Source phase imports are not allowed on statements that compile to CommonJS 'require' calls. + const b = import.source("./a.js"); + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).symbols b/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).symbols new file mode 100644 index 0000000000000..c2cc1fb8c36c4 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/importSource/importSource15.ts] //// + +=== a.js === + +export default 1; + +=== b.js === +import source a from "./a.js"; +>a : Symbol(a, Decl(b.js, 0, 6)) + +const b = import.source("./a.js"); +>b : Symbol(b, Decl(b.js, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).types b/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).types new file mode 100644 index 0000000000000..e19fadcaf9128 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource15(module=nodenext).types @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/importSource/importSource15.ts] //// + +=== a.js === + +export default 1; + +=== b.js === +import source a from "./a.js"; +>a : AbstractModuleSource + +const b = import.source("./a.js"); +>b : Promise +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).js b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).js new file mode 100644 index 0000000000000..e3dbae2eb063b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +//// [index.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} + + +//// [index.mjs] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path) { + return import.source(path); +} + + +//// [index.d.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +export declare const g: Promise; +export declare const h: Promise; +export declare const i: Promise; +export declare function load(path: string): Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).symbols b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).symbols new file mode 100644 index 0000000000000..9297c1090a92b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import source b from "missing"; +>b : Symbol(b, Decl(index.mts, 1, 6)) + +import source c from "./a.txt"; +>c : Symbol(c, Decl(index.mts, 2, 6)) + +import source d from "./a.js"; +>d : Symbol(d, Decl(index.mts, 3, 6)) + +import source e from "./a.d.ts"; +>e : Symbol(e, Decl(index.mts, 4, 6)) + +import source f from "./a.ts"; +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export { a, b, c, d, e, f }; +>a : Symbol(a, Decl(index.mts, 6, 8)) +>b : Symbol(b, Decl(index.mts, 6, 11)) +>c : Symbol(c, Decl(index.mts, 6, 14)) +>d : Symbol(d, Decl(index.mts, 6, 17)) +>e : Symbol(e, Decl(index.mts, 6, 20)) +>f : Symbol(f, Decl(index.mts, 6, 23)) + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : Symbol(sources, Decl(index.mts, 7, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) +>b : Symbol(b, Decl(index.mts, 1, 6)) +>c : Symbol(c, Decl(index.mts, 2, 6)) +>d : Symbol(d, Decl(index.mts, 3, 6)) +>e : Symbol(e, Decl(index.mts, 4, 6)) +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export const g = import.source("./missing.wasm"); +>g : Symbol(g, Decl(index.mts, 8, 12)) + +export const h = import.source("missing"); +>h : Symbol(h, Decl(index.mts, 9, 12)) + +export const i = import.source("./a.txt"); +>i : Symbol(i, Decl(index.mts, 10, 12)) + +export function load(path: string): Promise { +>load : Symbol(load, Decl(index.mts, 10, 42)) +>path : Symbol(path, Decl(index.mts, 11, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + + return import.source(path); +>path : Symbol(path, Decl(index.mts, 11, 21)) +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).types b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).types new file mode 100644 index 0000000000000..ac122c8cf9f7c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=false).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : AbstractModuleSource + +import source b from "missing"; +>b : AbstractModuleSource + +import source c from "./a.txt"; +>c : AbstractModuleSource + +import source d from "./a.js"; +>d : AbstractModuleSource + +import source e from "./a.d.ts"; +>e : AbstractModuleSource + +import source f from "./a.ts"; +>f : AbstractModuleSource + +export { a, b, c, d, e, f }; +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : AbstractModuleSource[] +>[a, b, c, d, e, f] : AbstractModuleSource[] +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +export const g = import.source("./missing.wasm"); +>g : Promise +>import.source("./missing.wasm") : Promise +>source : any +>"./missing.wasm" : "./missing.wasm" + +export const h = import.source("missing"); +>h : Promise +>import.source("missing") : Promise +>source : any +>"missing" : "missing" + +export const i = import.source("./a.txt"); +>i : Promise +>import.source("./a.txt") : Promise +>source : any +>"./a.txt" : "./a.txt" + +export function load(path: string): Promise { +>load : (path: string) => Promise +>path : string + + return import.source(path); +>import.source(path) : Promise +>source : any +>path : string +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).js b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).js new file mode 100644 index 0000000000000..e3dbae2eb063b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +//// [index.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} + + +//// [index.mjs] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path) { + return import.source(path); +} + + +//// [index.d.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +export declare const g: Promise; +export declare const h: Promise; +export declare const i: Promise; +export declare function load(path: string): Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).symbols b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).symbols new file mode 100644 index 0000000000000..9297c1090a92b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import source b from "missing"; +>b : Symbol(b, Decl(index.mts, 1, 6)) + +import source c from "./a.txt"; +>c : Symbol(c, Decl(index.mts, 2, 6)) + +import source d from "./a.js"; +>d : Symbol(d, Decl(index.mts, 3, 6)) + +import source e from "./a.d.ts"; +>e : Symbol(e, Decl(index.mts, 4, 6)) + +import source f from "./a.ts"; +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export { a, b, c, d, e, f }; +>a : Symbol(a, Decl(index.mts, 6, 8)) +>b : Symbol(b, Decl(index.mts, 6, 11)) +>c : Symbol(c, Decl(index.mts, 6, 14)) +>d : Symbol(d, Decl(index.mts, 6, 17)) +>e : Symbol(e, Decl(index.mts, 6, 20)) +>f : Symbol(f, Decl(index.mts, 6, 23)) + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : Symbol(sources, Decl(index.mts, 7, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) +>b : Symbol(b, Decl(index.mts, 1, 6)) +>c : Symbol(c, Decl(index.mts, 2, 6)) +>d : Symbol(d, Decl(index.mts, 3, 6)) +>e : Symbol(e, Decl(index.mts, 4, 6)) +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export const g = import.source("./missing.wasm"); +>g : Symbol(g, Decl(index.mts, 8, 12)) + +export const h = import.source("missing"); +>h : Symbol(h, Decl(index.mts, 9, 12)) + +export const i = import.source("./a.txt"); +>i : Symbol(i, Decl(index.mts, 10, 12)) + +export function load(path: string): Promise { +>load : Symbol(load, Decl(index.mts, 10, 42)) +>path : Symbol(path, Decl(index.mts, 11, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + + return import.source(path); +>path : Symbol(path, Decl(index.mts, 11, 21)) +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).types b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).types new file mode 100644 index 0000000000000..ac122c8cf9f7c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=esnext,nouncheckedsideeffectimports=true).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : AbstractModuleSource + +import source b from "missing"; +>b : AbstractModuleSource + +import source c from "./a.txt"; +>c : AbstractModuleSource + +import source d from "./a.js"; +>d : AbstractModuleSource + +import source e from "./a.d.ts"; +>e : AbstractModuleSource + +import source f from "./a.ts"; +>f : AbstractModuleSource + +export { a, b, c, d, e, f }; +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : AbstractModuleSource[] +>[a, b, c, d, e, f] : AbstractModuleSource[] +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +export const g = import.source("./missing.wasm"); +>g : Promise +>import.source("./missing.wasm") : Promise +>source : any +>"./missing.wasm" : "./missing.wasm" + +export const h = import.source("missing"); +>h : Promise +>import.source("missing") : Promise +>source : any +>"missing" : "missing" + +export const i = import.source("./a.txt"); +>i : Promise +>import.source("./a.txt") : Promise +>source : any +>"./a.txt" : "./a.txt" + +export function load(path: string): Promise { +>load : (path: string) => Promise +>path : string + + return import.source(path); +>import.source(path) : Promise +>source : any +>path : string +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).js b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).js new file mode 100644 index 0000000000000..e3dbae2eb063b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +//// [index.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} + + +//// [index.mjs] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path) { + return import.source(path); +} + + +//// [index.d.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +export declare const g: Promise; +export declare const h: Promise; +export declare const i: Promise; +export declare function load(path: string): Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).symbols b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).symbols new file mode 100644 index 0000000000000..9297c1090a92b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import source b from "missing"; +>b : Symbol(b, Decl(index.mts, 1, 6)) + +import source c from "./a.txt"; +>c : Symbol(c, Decl(index.mts, 2, 6)) + +import source d from "./a.js"; +>d : Symbol(d, Decl(index.mts, 3, 6)) + +import source e from "./a.d.ts"; +>e : Symbol(e, Decl(index.mts, 4, 6)) + +import source f from "./a.ts"; +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export { a, b, c, d, e, f }; +>a : Symbol(a, Decl(index.mts, 6, 8)) +>b : Symbol(b, Decl(index.mts, 6, 11)) +>c : Symbol(c, Decl(index.mts, 6, 14)) +>d : Symbol(d, Decl(index.mts, 6, 17)) +>e : Symbol(e, Decl(index.mts, 6, 20)) +>f : Symbol(f, Decl(index.mts, 6, 23)) + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : Symbol(sources, Decl(index.mts, 7, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) +>b : Symbol(b, Decl(index.mts, 1, 6)) +>c : Symbol(c, Decl(index.mts, 2, 6)) +>d : Symbol(d, Decl(index.mts, 3, 6)) +>e : Symbol(e, Decl(index.mts, 4, 6)) +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export const g = import.source("./missing.wasm"); +>g : Symbol(g, Decl(index.mts, 8, 12)) + +export const h = import.source("missing"); +>h : Symbol(h, Decl(index.mts, 9, 12)) + +export const i = import.source("./a.txt"); +>i : Symbol(i, Decl(index.mts, 10, 12)) + +export function load(path: string): Promise { +>load : Symbol(load, Decl(index.mts, 10, 42)) +>path : Symbol(path, Decl(index.mts, 11, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + + return import.source(path); +>path : Symbol(path, Decl(index.mts, 11, 21)) +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).types b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).types new file mode 100644 index 0000000000000..ac122c8cf9f7c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=false).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : AbstractModuleSource + +import source b from "missing"; +>b : AbstractModuleSource + +import source c from "./a.txt"; +>c : AbstractModuleSource + +import source d from "./a.js"; +>d : AbstractModuleSource + +import source e from "./a.d.ts"; +>e : AbstractModuleSource + +import source f from "./a.ts"; +>f : AbstractModuleSource + +export { a, b, c, d, e, f }; +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : AbstractModuleSource[] +>[a, b, c, d, e, f] : AbstractModuleSource[] +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +export const g = import.source("./missing.wasm"); +>g : Promise +>import.source("./missing.wasm") : Promise +>source : any +>"./missing.wasm" : "./missing.wasm" + +export const h = import.source("missing"); +>h : Promise +>import.source("missing") : Promise +>source : any +>"missing" : "missing" + +export const i = import.source("./a.txt"); +>i : Promise +>import.source("./a.txt") : Promise +>source : any +>"./a.txt" : "./a.txt" + +export function load(path: string): Promise { +>load : (path: string) => Promise +>path : string + + return import.source(path); +>import.source(path) : Promise +>source : any +>path : string +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).js b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).js new file mode 100644 index 0000000000000..e3dbae2eb063b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +//// [index.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} + + +//// [index.mjs] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path) { + return import.source(path); +} + + +//// [index.d.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +export declare const g: Promise; +export declare const h: Promise; +export declare const i: Promise; +export declare function load(path: string): Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).symbols b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).symbols new file mode 100644 index 0000000000000..9297c1090a92b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import source b from "missing"; +>b : Symbol(b, Decl(index.mts, 1, 6)) + +import source c from "./a.txt"; +>c : Symbol(c, Decl(index.mts, 2, 6)) + +import source d from "./a.js"; +>d : Symbol(d, Decl(index.mts, 3, 6)) + +import source e from "./a.d.ts"; +>e : Symbol(e, Decl(index.mts, 4, 6)) + +import source f from "./a.ts"; +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export { a, b, c, d, e, f }; +>a : Symbol(a, Decl(index.mts, 6, 8)) +>b : Symbol(b, Decl(index.mts, 6, 11)) +>c : Symbol(c, Decl(index.mts, 6, 14)) +>d : Symbol(d, Decl(index.mts, 6, 17)) +>e : Symbol(e, Decl(index.mts, 6, 20)) +>f : Symbol(f, Decl(index.mts, 6, 23)) + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : Symbol(sources, Decl(index.mts, 7, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) +>b : Symbol(b, Decl(index.mts, 1, 6)) +>c : Symbol(c, Decl(index.mts, 2, 6)) +>d : Symbol(d, Decl(index.mts, 3, 6)) +>e : Symbol(e, Decl(index.mts, 4, 6)) +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export const g = import.source("./missing.wasm"); +>g : Symbol(g, Decl(index.mts, 8, 12)) + +export const h = import.source("missing"); +>h : Symbol(h, Decl(index.mts, 9, 12)) + +export const i = import.source("./a.txt"); +>i : Symbol(i, Decl(index.mts, 10, 12)) + +export function load(path: string): Promise { +>load : Symbol(load, Decl(index.mts, 10, 42)) +>path : Symbol(path, Decl(index.mts, 11, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + + return import.source(path); +>path : Symbol(path, Decl(index.mts, 11, 21)) +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).types b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).types new file mode 100644 index 0000000000000..ac122c8cf9f7c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=nodenext,nouncheckedsideeffectimports=true).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : AbstractModuleSource + +import source b from "missing"; +>b : AbstractModuleSource + +import source c from "./a.txt"; +>c : AbstractModuleSource + +import source d from "./a.js"; +>d : AbstractModuleSource + +import source e from "./a.d.ts"; +>e : AbstractModuleSource + +import source f from "./a.ts"; +>f : AbstractModuleSource + +export { a, b, c, d, e, f }; +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : AbstractModuleSource[] +>[a, b, c, d, e, f] : AbstractModuleSource[] +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +export const g = import.source("./missing.wasm"); +>g : Promise +>import.source("./missing.wasm") : Promise +>source : any +>"./missing.wasm" : "./missing.wasm" + +export const h = import.source("missing"); +>h : Promise +>import.source("missing") : Promise +>source : any +>"missing" : "missing" + +export const i = import.source("./a.txt"); +>i : Promise +>import.source("./a.txt") : Promise +>source : any +>"./a.txt" : "./a.txt" + +export function load(path: string): Promise { +>load : (path: string) => Promise +>path : string + + return import.source(path); +>import.source(path) : Promise +>source : any +>path : string +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).js b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).js new file mode 100644 index 0000000000000..e3dbae2eb063b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +//// [index.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} + + +//// [index.mjs] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path) { + return import.source(path); +} + + +//// [index.d.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +export declare const g: Promise; +export declare const h: Promise; +export declare const i: Promise; +export declare function load(path: string): Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).symbols b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).symbols new file mode 100644 index 0000000000000..9297c1090a92b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import source b from "missing"; +>b : Symbol(b, Decl(index.mts, 1, 6)) + +import source c from "./a.txt"; +>c : Symbol(c, Decl(index.mts, 2, 6)) + +import source d from "./a.js"; +>d : Symbol(d, Decl(index.mts, 3, 6)) + +import source e from "./a.d.ts"; +>e : Symbol(e, Decl(index.mts, 4, 6)) + +import source f from "./a.ts"; +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export { a, b, c, d, e, f }; +>a : Symbol(a, Decl(index.mts, 6, 8)) +>b : Symbol(b, Decl(index.mts, 6, 11)) +>c : Symbol(c, Decl(index.mts, 6, 14)) +>d : Symbol(d, Decl(index.mts, 6, 17)) +>e : Symbol(e, Decl(index.mts, 6, 20)) +>f : Symbol(f, Decl(index.mts, 6, 23)) + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : Symbol(sources, Decl(index.mts, 7, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) +>b : Symbol(b, Decl(index.mts, 1, 6)) +>c : Symbol(c, Decl(index.mts, 2, 6)) +>d : Symbol(d, Decl(index.mts, 3, 6)) +>e : Symbol(e, Decl(index.mts, 4, 6)) +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export const g = import.source("./missing.wasm"); +>g : Symbol(g, Decl(index.mts, 8, 12)) + +export const h = import.source("missing"); +>h : Symbol(h, Decl(index.mts, 9, 12)) + +export const i = import.source("./a.txt"); +>i : Symbol(i, Decl(index.mts, 10, 12)) + +export function load(path: string): Promise { +>load : Symbol(load, Decl(index.mts, 10, 42)) +>path : Symbol(path, Decl(index.mts, 11, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + + return import.source(path); +>path : Symbol(path, Decl(index.mts, 11, 21)) +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).types b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).types new file mode 100644 index 0000000000000..ac122c8cf9f7c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=false).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : AbstractModuleSource + +import source b from "missing"; +>b : AbstractModuleSource + +import source c from "./a.txt"; +>c : AbstractModuleSource + +import source d from "./a.js"; +>d : AbstractModuleSource + +import source e from "./a.d.ts"; +>e : AbstractModuleSource + +import source f from "./a.ts"; +>f : AbstractModuleSource + +export { a, b, c, d, e, f }; +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : AbstractModuleSource[] +>[a, b, c, d, e, f] : AbstractModuleSource[] +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +export const g = import.source("./missing.wasm"); +>g : Promise +>import.source("./missing.wasm") : Promise +>source : any +>"./missing.wasm" : "./missing.wasm" + +export const h = import.source("missing"); +>h : Promise +>import.source("missing") : Promise +>source : any +>"missing" : "missing" + +export const i = import.source("./a.txt"); +>i : Promise +>import.source("./a.txt") : Promise +>source : any +>"./a.txt" : "./a.txt" + +export function load(path: string): Promise { +>load : (path: string) => Promise +>path : string + + return import.source(path); +>import.source(path) : Promise +>source : any +>path : string +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).js b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).js new file mode 100644 index 0000000000000..e3dbae2eb063b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +//// [index.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} + + +//// [index.mjs] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path) { + return import.source(path); +} + + +//// [index.d.mts] +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +export declare const g: Promise; +export declare const h: Promise; +export declare const i: Promise; +export declare function load(path: string): Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).symbols b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).symbols new file mode 100644 index 0000000000000..9297c1090a92b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).symbols @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import source b from "missing"; +>b : Symbol(b, Decl(index.mts, 1, 6)) + +import source c from "./a.txt"; +>c : Symbol(c, Decl(index.mts, 2, 6)) + +import source d from "./a.js"; +>d : Symbol(d, Decl(index.mts, 3, 6)) + +import source e from "./a.d.ts"; +>e : Symbol(e, Decl(index.mts, 4, 6)) + +import source f from "./a.ts"; +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export { a, b, c, d, e, f }; +>a : Symbol(a, Decl(index.mts, 6, 8)) +>b : Symbol(b, Decl(index.mts, 6, 11)) +>c : Symbol(c, Decl(index.mts, 6, 14)) +>d : Symbol(d, Decl(index.mts, 6, 17)) +>e : Symbol(e, Decl(index.mts, 6, 20)) +>f : Symbol(f, Decl(index.mts, 6, 23)) + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : Symbol(sources, Decl(index.mts, 7, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) +>b : Symbol(b, Decl(index.mts, 1, 6)) +>c : Symbol(c, Decl(index.mts, 2, 6)) +>d : Symbol(d, Decl(index.mts, 3, 6)) +>e : Symbol(e, Decl(index.mts, 4, 6)) +>f : Symbol(f, Decl(index.mts, 5, 6)) + +export const g = import.source("./missing.wasm"); +>g : Symbol(g, Decl(index.mts, 8, 12)) + +export const h = import.source("missing"); +>h : Symbol(h, Decl(index.mts, 9, 12)) + +export const i = import.source("./a.txt"); +>i : Symbol(i, Decl(index.mts, 10, 12)) + +export function load(path: string): Promise { +>load : Symbol(load, Decl(index.mts, 10, 42)) +>path : Symbol(path, Decl(index.mts, 11, 21)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + + return import.source(path); +>path : Symbol(path, Decl(index.mts, 11, 21)) +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).types b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).types new file mode 100644 index 0000000000000..ac122c8cf9f7c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource16(module=preserve,nouncheckedsideeffectimports=true).types @@ -0,0 +1,67 @@ +//// [tests/cases/conformance/importSource/importSource16.ts] //// + +=== index.mts === +import source a from "./missing.wasm"; +>a : AbstractModuleSource + +import source b from "missing"; +>b : AbstractModuleSource + +import source c from "./a.txt"; +>c : AbstractModuleSource + +import source d from "./a.js"; +>d : AbstractModuleSource + +import source e from "./a.d.ts"; +>e : AbstractModuleSource + +import source f from "./a.ts"; +>f : AbstractModuleSource + +export { a, b, c, d, e, f }; +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +>sources : AbstractModuleSource[] +>[a, b, c, d, e, f] : AbstractModuleSource[] +>a : AbstractModuleSource +>b : AbstractModuleSource +>c : AbstractModuleSource +>d : AbstractModuleSource +>e : AbstractModuleSource +>f : AbstractModuleSource + +export const g = import.source("./missing.wasm"); +>g : Promise +>import.source("./missing.wasm") : Promise +>source : any +>"./missing.wasm" : "./missing.wasm" + +export const h = import.source("missing"); +>h : Promise +>import.source("missing") : Promise +>source : any +>"missing" : "missing" + +export const i = import.source("./a.txt"); +>i : Promise +>import.source("./a.txt") : Promise +>source : any +>"./a.txt" : "./a.txt" + +export function load(path: string): Promise { +>load : (path: string) => Promise +>path : string + + return import.source(path); +>import.source(path) : Promise +>source : any +>path : string +} + diff --git a/tsc/testdata/baselines/reference/conformance/importSource17.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource17.errors.txt new file mode 100644 index 0000000000000..f860448fbb456 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource17.errors.txt @@ -0,0 +1,61 @@ +index.ts(2,7): error TS2322: Type 'AbstractModuleSource' is not assignable to type 'string'. +index.ts(3,3): error TS2339: Property 'exports' does not exist on type 'AbstractModuleSource'. +index.ts(4,3): error TS2339: Property 'value' does not exist on type 'AbstractModuleSource'. +index.ts(5,8): error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'AbstractModuleSource'. +index.ts(6,15): error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'AbstractModuleSource'. +index.ts(7,15): error TS7036: Dynamic import's specifier must be of type 'string', but here has type '1'. +index.ts(8,15): error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'undefined'. +index.ts(9,27): error TS2559: Type '1' has no properties in common with type 'ImportCallOptions'. +index.ts(10,27): error TS2322: Type '{ with: { readonly type: 1; }; }' is not assignable to type 'ImportCallOptions'. + Types of property 'with' are incompatible. + Type '{ readonly type: 1; }' is not assignable to type 'ImportAttributes'. + Property 'type' is incompatible with index signature. + Type 'number' is not assignable to type 'string'. +index.ts(11,29): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +index.ts(12,5): error TS2693: 'AbstractModuleSource' only refers to a type, but is being used as a value here. +index.ts(13,10): error TS2315: Type 'AbstractModuleSource' is not generic. + + +==== index.ts (12 errors) ==== + import source a from "./a.wasm"; + const b: string = a; + ~ +!!! error TS2322: Type 'AbstractModuleSource' is not assignable to type 'string'. + a.exports; + ~~~~~~~ +!!! error TS2339: Property 'exports' does not exist on type 'AbstractModuleSource'. + a.value; + ~~~~~ +!!! error TS2339: Property 'value' does not exist on type 'AbstractModuleSource'. + import(a); + ~ +!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'AbstractModuleSource'. + import.source(a); + ~ +!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'AbstractModuleSource'. + import.source(1); + ~ +!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type '1'. + import.source(undefined); + ~~~~~~~~~ +!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'undefined'. + import.source("./a.wasm", 1); + ~ +!!! error TS2559: Type '1' has no properties in common with type 'ImportCallOptions'. + import.source("./a.wasm", { with: { type: 1 } }); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ with: { readonly type: 1; }; }' is not assignable to type 'ImportCallOptions'. +!!! error TS2322: Types of property 'with' are incompatible. +!!! error TS2322: Type '{ readonly type: 1; }' is not assignable to type 'ImportAttributes'. +!!! error TS2322: Property 'type' is incompatible with index signature. +!!! error TS2322: Type 'number' is not assignable to type 'string'. + import.source("./a.wasm", { assert: { type: "webassembly" } }); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + new AbstractModuleSource(); + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2693: 'AbstractModuleSource' only refers to a type, but is being used as a value here. + type C = AbstractModuleSource; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'AbstractModuleSource' is not generic. + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource17.js b/tsc/testdata/baselines/reference/conformance/importSource17.js new file mode 100644 index 0000000000000..5c402541699fb --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource17.js @@ -0,0 +1,31 @@ +//// [tests/cases/conformance/importSource/importSource17.ts] //// + +//// [index.ts] +import source a from "./a.wasm"; +const b: string = a; +a.exports; +a.value; +import(a); +import.source(a); +import.source(1); +import.source(undefined); +import.source("./a.wasm", 1); +import.source("./a.wasm", { with: { type: 1 } }); +import.source("./a.wasm", { assert: { type: "webassembly" } }); +new AbstractModuleSource(); +type C = AbstractModuleSource; + + +//// [index.js] +import source a from "./a.wasm"; +const b = a; +a.exports; +a.value; +import(a); +import.source(a); +import.source(1); +import.source(undefined); +import.source("./a.wasm", 1); +import.source("./a.wasm", { with: { type: 1 } }); +import.source("./a.wasm", { assert: { type: "webassembly" } }); +new AbstractModuleSource(); diff --git a/tsc/testdata/baselines/reference/conformance/importSource17.symbols b/tsc/testdata/baselines/reference/conformance/importSource17.symbols new file mode 100644 index 0000000000000..f16cb30ec838b --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource17.symbols @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/importSource/importSource17.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +const b: string = a; +>b : Symbol(b, Decl(index.ts, 1, 5)) +>a : Symbol(a, Decl(index.ts, 0, 6)) + +a.exports; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +a.value; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import(a); +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import.source(a); +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import.source(1); +import.source(undefined); +>undefined : Symbol(undefined) + +import.source("./a.wasm", 1); +import.source("./a.wasm", { with: { type: 1 } }); +>with : Symbol(with, Decl(index.ts, 9, 27)) +>type : Symbol(type, Decl(index.ts, 9, 35)) + +import.source("./a.wasm", { assert: { type: "webassembly" } }); +>assert : Symbol(assert, Decl(index.ts, 10, 27)) +>type : Symbol(type, Decl(index.ts, 10, 37)) + +new AbstractModuleSource(); +type C = AbstractModuleSource; +>C : Symbol(C, Decl(index.ts, 11, 27)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource17.types b/tsc/testdata/baselines/reference/conformance/importSource17.types new file mode 100644 index 0000000000000..af700343c9c25 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource17.types @@ -0,0 +1,72 @@ +//// [tests/cases/conformance/importSource/importSource17.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +const b: string = a; +>b : string +>a : AbstractModuleSource + +a.exports; +>a.exports : any +>a : AbstractModuleSource +>exports : any + +a.value; +>a.value : any +>a : AbstractModuleSource +>value : any + +import(a); +>import(a) : Promise +>a : AbstractModuleSource + +import.source(a); +>import.source(a) : Promise +>source : any +>a : AbstractModuleSource + +import.source(1); +>import.source(1) : Promise +>source : any +>1 : 1 + +import.source(undefined); +>import.source(undefined) : Promise +>source : any +>undefined : undefined + +import.source("./a.wasm", 1); +>import.source("./a.wasm", 1) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>1 : 1 + +import.source("./a.wasm", { with: { type: 1 } }); +>import.source("./a.wasm", { with: { type: 1 } }) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>{ with: { type: 1 } } : { with: { readonly type: 1; }; } +>with : { readonly type: 1; } +>{ type: 1 } : { readonly type: 1; } +>type : 1 +>1 : 1 + +import.source("./a.wasm", { assert: { type: "webassembly" } }); +>import.source("./a.wasm", { assert: { type: "webassembly" } }) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>{ assert: { type: "webassembly" } } : { assert: { type: string; }; } +>assert : { type: string; } +>{ type: "webassembly" } : { type: string; } +>type : string +>"webassembly" : "webassembly" + +new AbstractModuleSource(); +>new AbstractModuleSource() : any +>AbstractModuleSource : any + +type C = AbstractModuleSource; +>C : any + diff --git a/tsc/testdata/baselines/reference/conformance/importSource18.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource18.errors.txt new file mode 100644 index 0000000000000..cc380c101dce3 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource18.errors.txt @@ -0,0 +1,9 @@ +error TS2318: Cannot find global type 'AbstractModuleSource'. + + +!!! error TS2318: Cannot find global type 'AbstractModuleSource'. +==== index.ts (0 errors) ==== + import source a from "./a.wasm"; + a; + import.source("./a.wasm"); + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource18.js b/tsc/testdata/baselines/reference/conformance/importSource18.js new file mode 100644 index 0000000000000..c6a6e70a557eb --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource18.js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/importSource/importSource18.ts] //// + +//// [index.ts] +import source a from "./a.wasm"; +a; +import.source("./a.wasm"); + + +//// [index.js] +import source a from "./a.wasm"; +a; +import.source("./a.wasm"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource18.symbols b/tsc/testdata/baselines/reference/conformance/importSource18.symbols new file mode 100644 index 0000000000000..d883410b019b6 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource18.symbols @@ -0,0 +1,11 @@ +//// [tests/cases/conformance/importSource/importSource18.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +a; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import.source("./a.wasm"); + diff --git a/tsc/testdata/baselines/reference/conformance/importSource18.types b/tsc/testdata/baselines/reference/conformance/importSource18.types new file mode 100644 index 0000000000000..047f341f2606e --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource18.types @@ -0,0 +1,14 @@ +//// [tests/cases/conformance/importSource/importSource18.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : {} + +a; +>a : {} + +import.source("./a.wasm"); +>import.source("./a.wasm") : Promise<{}> +>source : any +>"./a.wasm" : "./a.wasm" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource19.js b/tsc/testdata/baselines/reference/conformance/importSource19.js new file mode 100644 index 0000000000000..0930ce9573336 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource19.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/importSource/importSource19.ts] //// + +//// [globals.d.ts] +declare module "*.wasm" { + const value: string; + export default value; +} +declare namespace WebAssembly { + interface Module { value: number; } +} + +//// [index.ts] +import a from "./a.wasm"; +import source b from "./a.wasm"; +const c: string = a; +const d: AbstractModuleSource = b; +export { b }; +export const e = import.source("./a.wasm"); + + +//// [index.js] +import a from "./a.wasm"; +import source b from "./a.wasm"; +const c = a; +const d = b; +export { b }; +export const e = import.source("./a.wasm"); + + +//// [index.d.ts] +import source b from "./a.wasm"; +export { b }; +export declare const e: Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource19.symbols b/tsc/testdata/baselines/reference/conformance/importSource19.symbols new file mode 100644 index 0000000000000..bc2c53509e45a --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource19.symbols @@ -0,0 +1,42 @@ +//// [tests/cases/conformance/importSource/importSource19.ts] //// + +=== globals.d.ts === +declare module "*.wasm" { +>"*.wasm" : Symbol("*.wasm", Decl(globals.d.ts, 0, 0)) + + const value: string; +>value : Symbol(value, Decl(globals.d.ts, 1, 9)) + + export default value; +>value : Symbol(value, Decl(globals.d.ts, 1, 9)) +} +declare namespace WebAssembly { +>WebAssembly : Symbol(WebAssembly, Decl(lib.dom.d.ts, --, --), Decl(globals.d.ts, 3, 1)) + + interface Module { value: number; } +>Module : Symbol(Module, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(globals.d.ts, 4, 31)) +>value : Symbol(Module.value, Decl(globals.d.ts, 5, 22)) +} + +=== index.ts === +import a from "./a.wasm"; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import source b from "./a.wasm"; +>b : Symbol(b, Decl(index.ts, 1, 6)) + +const c: string = a; +>c : Symbol(c, Decl(index.ts, 2, 5)) +>a : Symbol(a, Decl(index.ts, 0, 6)) + +const d: AbstractModuleSource = b; +>d : Symbol(d, Decl(index.ts, 3, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>b : Symbol(b, Decl(index.ts, 1, 6)) + +export { b }; +>b : Symbol(b, Decl(index.ts, 4, 8)) + +export const e = import.source("./a.wasm"); +>e : Symbol(e, Decl(index.ts, 5, 12)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource19.types b/tsc/testdata/baselines/reference/conformance/importSource19.types new file mode 100644 index 0000000000000..16817f8653d12 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource19.types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/importSource/importSource19.ts] //// + +=== globals.d.ts === +declare module "*.wasm" { +>"*.wasm" : typeof import("*.wasm") + + const value: string; +>value : string + + export default value; +>value : string +} +declare namespace WebAssembly { + interface Module { value: number; } +>value : number +} + +=== index.ts === +import a from "./a.wasm"; +>a : string + +import source b from "./a.wasm"; +>b : AbstractModuleSource + +const c: string = a; +>c : string +>a : string + +const d: AbstractModuleSource = b; +>d : AbstractModuleSource +>b : AbstractModuleSource + +export { b }; +>b : AbstractModuleSource + +export const e = import.source("./a.wasm"); +>e : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).js b/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).js new file mode 100644 index 0000000000000..a31824c603ba0 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).js @@ -0,0 +1,43 @@ +//// [tests/cases/conformance/importSource/importSource2.ts] //// + +//// [b.ts] +export {}; +const a = import.source("./a.wasm"); +const b: Promise = a; + +//// [c.ts] +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +const b: Promise = a; + +//// [d.ts] +export {}; +const a = import.source("./a.wasm",); +const b: Promise = a; +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +const d: Promise = c; + +//// [e.ts] +export {}; +const a = import.source(`./a.wasm`); +const b: Promise = a; + + +//// [b.js] +const a = import.source("./a.wasm"); +const b = a; +export {}; +//// [c.js] +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +const b = a; +export {}; +//// [d.js] +const a = import.source("./a.wasm"); +const b = a; +const c = import.source("./a.wasm", { with: { type: "webassembly" } }); +const d = c; +export {}; +//// [e.js] +const a = import.source(`./a.wasm`); +const b = a; +export {}; diff --git a/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).symbols b/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).symbols new file mode 100644 index 0000000000000..7cc67459084ca --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).symbols @@ -0,0 +1,59 @@ +//// [tests/cases/conformance/importSource/importSource2.ts] //// + +=== b.ts === +export {}; +const a = import.source("./a.wasm"); +>a : Symbol(a, Decl(b.ts, 1, 5)) + +const b: Promise = a; +>b : Symbol(b, Decl(b.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(b.ts, 1, 5)) + +=== c.ts === +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +>a : Symbol(a, Decl(c.ts, 1, 5)) +>with : Symbol(with, Decl(c.ts, 1, 37)) +>type : Symbol(type, Decl(c.ts, 1, 45)) + +const b: Promise = a; +>b : Symbol(b, Decl(c.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(c.ts, 1, 5)) + +=== d.ts === +export {}; +const a = import.source("./a.wasm",); +>a : Symbol(a, Decl(d.ts, 1, 5)) + +const b: Promise = a; +>b : Symbol(b, Decl(d.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(d.ts, 1, 5)) + +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +>c : Symbol(c, Decl(d.ts, 3, 5)) +>with : Symbol(with, Decl(d.ts, 3, 37)) +>type : Symbol(type, Decl(d.ts, 3, 45)) + +const d: Promise = c; +>d : Symbol(d, Decl(d.ts, 4, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>c : Symbol(c, Decl(d.ts, 3, 5)) + +=== e.ts === +export {}; +const a = import.source(`./a.wasm`); +>a : Symbol(a, Decl(e.ts, 1, 5)) + +const b: Promise = a; +>b : Symbol(b, Decl(e.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(e.ts, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).types b/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).types new file mode 100644 index 0000000000000..857291404b4bc --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource2(module=esnext).types @@ -0,0 +1,70 @@ +//// [tests/cases/conformance/importSource/importSource2.ts] //// + +=== b.ts === +export {}; +const a = import.source("./a.wasm"); +>a : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + +const b: Promise = a; +>b : Promise +>a : Promise + +=== c.ts === +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +>a : Promise +>import.source("./a.wasm", { with: { type: "webassembly" } }) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>{ with: { type: "webassembly" } } : { with: { readonly type: "webassembly"; }; } +>with : { readonly type: "webassembly"; } +>{ type: "webassembly" } : { readonly type: "webassembly"; } +>type : "webassembly" +>"webassembly" : "webassembly" + +const b: Promise = a; +>b : Promise +>a : Promise + +=== d.ts === +export {}; +const a = import.source("./a.wasm",); +>a : Promise +>import.source("./a.wasm",) : Promise +>source : any +>"./a.wasm" : "./a.wasm" + +const b: Promise = a; +>b : Promise +>a : Promise + +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +>c : Promise +>import.source("./a.wasm", { with: { type: "webassembly" } },) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>{ with: { type: "webassembly" } } : { with: { readonly type: "webassembly"; }; } +>with : { readonly type: "webassembly"; } +>{ type: "webassembly" } : { readonly type: "webassembly"; } +>type : "webassembly" +>"webassembly" : "webassembly" + +const d: Promise = c; +>d : Promise +>c : Promise + +=== e.ts === +export {}; +const a = import.source(`./a.wasm`); +>a : Promise +>import.source(`./a.wasm`) : Promise +>source : any +>`./a.wasm` : "./a.wasm" + +const b: Promise = a; +>b : Promise +>a : Promise + diff --git a/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).js b/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).js new file mode 100644 index 0000000000000..1a4f156f46ea9 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/importSource/importSource2.ts] //// + +//// [b.ts] +export {}; +const a = import.source("./a.wasm"); +const b: Promise = a; + +//// [c.ts] +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +const b: Promise = a; + +//// [d.ts] +export {}; +const a = import.source("./a.wasm",); +const b: Promise = a; +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +const d: Promise = c; + +//// [e.ts] +export {}; +const a = import.source(`./a.wasm`); +const b: Promise = a; + + +//// [b.js] +const a = import.source("./a.wasm"); +const b = a; +//// [c.js] +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +const b = a; +//// [d.js] +const a = import.source("./a.wasm"); +const b = a; +const c = import.source("./a.wasm", { with: { type: "webassembly" } }); +const d = c; +//// [e.js] +const a = import.source(`./a.wasm`); +const b = a; diff --git a/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).symbols b/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).symbols new file mode 100644 index 0000000000000..7cc67459084ca --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).symbols @@ -0,0 +1,59 @@ +//// [tests/cases/conformance/importSource/importSource2.ts] //// + +=== b.ts === +export {}; +const a = import.source("./a.wasm"); +>a : Symbol(a, Decl(b.ts, 1, 5)) + +const b: Promise = a; +>b : Symbol(b, Decl(b.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(b.ts, 1, 5)) + +=== c.ts === +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +>a : Symbol(a, Decl(c.ts, 1, 5)) +>with : Symbol(with, Decl(c.ts, 1, 37)) +>type : Symbol(type, Decl(c.ts, 1, 45)) + +const b: Promise = a; +>b : Symbol(b, Decl(c.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(c.ts, 1, 5)) + +=== d.ts === +export {}; +const a = import.source("./a.wasm",); +>a : Symbol(a, Decl(d.ts, 1, 5)) + +const b: Promise = a; +>b : Symbol(b, Decl(d.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(d.ts, 1, 5)) + +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +>c : Symbol(c, Decl(d.ts, 3, 5)) +>with : Symbol(with, Decl(d.ts, 3, 37)) +>type : Symbol(type, Decl(d.ts, 3, 45)) + +const d: Promise = c; +>d : Symbol(d, Decl(d.ts, 4, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>c : Symbol(c, Decl(d.ts, 3, 5)) + +=== e.ts === +export {}; +const a = import.source(`./a.wasm`); +>a : Symbol(a, Decl(e.ts, 1, 5)) + +const b: Promise = a; +>b : Symbol(b, Decl(e.ts, 2, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(e.ts, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).types b/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).types new file mode 100644 index 0000000000000..857291404b4bc --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource2(module=preserve).types @@ -0,0 +1,70 @@ +//// [tests/cases/conformance/importSource/importSource2.ts] //// + +=== b.ts === +export {}; +const a = import.source("./a.wasm"); +>a : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + +const b: Promise = a; +>b : Promise +>a : Promise + +=== c.ts === +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +>a : Promise +>import.source("./a.wasm", { with: { type: "webassembly" } }) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>{ with: { type: "webassembly" } } : { with: { readonly type: "webassembly"; }; } +>with : { readonly type: "webassembly"; } +>{ type: "webassembly" } : { readonly type: "webassembly"; } +>type : "webassembly" +>"webassembly" : "webassembly" + +const b: Promise = a; +>b : Promise +>a : Promise + +=== d.ts === +export {}; +const a = import.source("./a.wasm",); +>a : Promise +>import.source("./a.wasm",) : Promise +>source : any +>"./a.wasm" : "./a.wasm" + +const b: Promise = a; +>b : Promise +>a : Promise + +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +>c : Promise +>import.source("./a.wasm", { with: { type: "webassembly" } },) : Promise +>source : any +>"./a.wasm" : "./a.wasm" +>{ with: { type: "webassembly" } } : { with: { readonly type: "webassembly"; }; } +>with : { readonly type: "webassembly"; } +>{ type: "webassembly" } : { readonly type: "webassembly"; } +>type : "webassembly" +>"webassembly" : "webassembly" + +const d: Promise = c; +>d : Promise +>c : Promise + +=== e.ts === +export {}; +const a = import.source(`./a.wasm`); +>a : Promise +>import.source(`./a.wasm`) : Promise +>source : any +>`./a.wasm` : "./a.wasm" + +const b: Promise = a; +>b : Promise +>a : Promise + diff --git a/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).js b/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).js new file mode 100644 index 0000000000000..59364ec365456 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/importSource/importSource20.ts] //// + +//// [package.json] +{ "type": "module", "exports": { "types": "./index.d.ts", "default": "./missing.wasm" } } + +//// [index.d.ts] +export const value: number; + +//// [index.mts] +import source a from "pkg"; +import { value } from "pkg"; +const b: AbstractModuleSource = a; +const c: number = value; +export const d = import.source("pkg"); +export const e = import("pkg"); +export { a }; + + +//// [index.mjs] +import source a from "pkg"; +import { value } from "pkg"; +const b = a; +const c = value; +export const d = import.source("pkg"); +export const e = import("pkg"); +export { a }; + + +//// [index.d.mts] +import source a from "pkg"; +export declare const d: Promise; +export declare const e: Promise; +export { a }; diff --git a/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).symbols b/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).symbols new file mode 100644 index 0000000000000..a2b6cfba0a938 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).symbols @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/importSource/importSource20.ts] //// + +=== index.mts === +import source a from "pkg"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import { value } from "pkg"; +>value : Symbol(value, Decl(index.mts, 1, 8)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(index.mts, 2, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) + +const c: number = value; +>c : Symbol(c, Decl(index.mts, 3, 5)) +>value : Symbol(value, Decl(index.mts, 1, 8)) + +export const d = import.source("pkg"); +>d : Symbol(d, Decl(index.mts, 4, 12)) + +export const e = import("pkg"); +>e : Symbol(e, Decl(index.mts, 5, 12)) +>"pkg" : Symbol("pkg", Decl(index.d.ts, 0, 0)) + +export { a }; +>a : Symbol(a, Decl(index.mts, 6, 8)) + +=== node_modules/pkg/index.d.ts === +export const value: number; +>value : Symbol(value, Decl(index.d.ts, 0, 12)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).types b/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).types new file mode 100644 index 0000000000000..856a2ee1b0c83 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource20(module=nodenext).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/importSource/importSource20.ts] //// + +=== index.mts === +import source a from "pkg"; +>a : AbstractModuleSource + +import { value } from "pkg"; +>value : number + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +const c: number = value; +>c : number +>value : number + +export const d = import.source("pkg"); +>d : Promise +>import.source("pkg") : Promise +>source : any +>"pkg" : "pkg" + +export const e = import("pkg"); +>e : Promise +>import("pkg") : Promise +>"pkg" : "pkg" + +export { a }; +>a : AbstractModuleSource + +=== node_modules/pkg/index.d.ts === +export const value: number; +>value : number + diff --git a/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).js b/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).js new file mode 100644 index 0000000000000..59364ec365456 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/importSource/importSource20.ts] //// + +//// [package.json] +{ "type": "module", "exports": { "types": "./index.d.ts", "default": "./missing.wasm" } } + +//// [index.d.ts] +export const value: number; + +//// [index.mts] +import source a from "pkg"; +import { value } from "pkg"; +const b: AbstractModuleSource = a; +const c: number = value; +export const d = import.source("pkg"); +export const e = import("pkg"); +export { a }; + + +//// [index.mjs] +import source a from "pkg"; +import { value } from "pkg"; +const b = a; +const c = value; +export const d = import.source("pkg"); +export const e = import("pkg"); +export { a }; + + +//// [index.d.mts] +import source a from "pkg"; +export declare const d: Promise; +export declare const e: Promise; +export { a }; diff --git a/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).symbols b/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).symbols new file mode 100644 index 0000000000000..a2b6cfba0a938 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).symbols @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/importSource/importSource20.ts] //// + +=== index.mts === +import source a from "pkg"; +>a : Symbol(a, Decl(index.mts, 0, 6)) + +import { value } from "pkg"; +>value : Symbol(value, Decl(index.mts, 1, 8)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(index.mts, 2, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(index.mts, 0, 6)) + +const c: number = value; +>c : Symbol(c, Decl(index.mts, 3, 5)) +>value : Symbol(value, Decl(index.mts, 1, 8)) + +export const d = import.source("pkg"); +>d : Symbol(d, Decl(index.mts, 4, 12)) + +export const e = import("pkg"); +>e : Symbol(e, Decl(index.mts, 5, 12)) +>"pkg" : Symbol("pkg", Decl(index.d.ts, 0, 0)) + +export { a }; +>a : Symbol(a, Decl(index.mts, 6, 8)) + +=== node_modules/pkg/index.d.ts === +export const value: number; +>value : Symbol(value, Decl(index.d.ts, 0, 12)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).types b/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).types new file mode 100644 index 0000000000000..856a2ee1b0c83 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource20(module=preserve).types @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/importSource/importSource20.ts] //// + +=== index.mts === +import source a from "pkg"; +>a : AbstractModuleSource + +import { value } from "pkg"; +>value : number + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +const c: number = value; +>c : number +>value : number + +export const d = import.source("pkg"); +>d : Promise +>import.source("pkg") : Promise +>source : any +>"pkg" : "pkg" + +export const e = import("pkg"); +>e : Promise +>import("pkg") : Promise +>"pkg" : "pkg" + +export { a }; +>a : AbstractModuleSource + +=== node_modules/pkg/index.d.ts === +export const value: number; +>value : number + diff --git a/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).js b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).js new file mode 100644 index 0000000000000..78ed32003a4e6 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/importSource/importSource21.ts] //// + +//// [index.ts] +import source a from "./a.wasm"; +import source b from "./b.wasm"; +import source c from "./c.wasm"; +export type A = typeof a; +export const d = c; + + +//// [index.js] +import source c from "./c.wasm"; +export const d = c; + + +//// [index.d.ts] +import source a from "./a.wasm"; +export type A = typeof a; +export declare const d: AbstractModuleSource; diff --git a/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).symbols b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).symbols new file mode 100644 index 0000000000000..df7b459d92feb --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource21.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import source b from "./b.wasm"; +>b : Symbol(b, Decl(index.ts, 1, 6)) + +import source c from "./c.wasm"; +>c : Symbol(c, Decl(index.ts, 2, 6)) + +export type A = typeof a; +>A : Symbol(A, Decl(index.ts, 2, 32)) +>a : Symbol(a, Decl(index.ts, 0, 6)) + +export const d = c; +>d : Symbol(d, Decl(index.ts, 4, 12)) +>c : Symbol(c, Decl(index.ts, 2, 6)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).types b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).types new file mode 100644 index 0000000000000..5ae56f0418e00 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=false).types @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource21.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +import source b from "./b.wasm"; +>b : AbstractModuleSource + +import source c from "./c.wasm"; +>c : AbstractModuleSource + +export type A = typeof a; +>A : AbstractModuleSource +>a : AbstractModuleSource + +export const d = c; +>d : AbstractModuleSource +>c : AbstractModuleSource + diff --git a/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).js b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).js new file mode 100644 index 0000000000000..5a2da381607b8 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/importSource/importSource21.ts] //// + +//// [index.ts] +import source a from "./a.wasm"; +import source b from "./b.wasm"; +import source c from "./c.wasm"; +export type A = typeof a; +export const d = c; + + +//// [index.js] +import source a from "./a.wasm"; +import source b from "./b.wasm"; +import source c from "./c.wasm"; +export const d = c; + + +//// [index.d.ts] +import source a from "./a.wasm"; +export type A = typeof a; +export declare const d: AbstractModuleSource; diff --git a/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).symbols b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).symbols new file mode 100644 index 0000000000000..df7b459d92feb --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).symbols @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource21.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(index.ts, 0, 6)) + +import source b from "./b.wasm"; +>b : Symbol(b, Decl(index.ts, 1, 6)) + +import source c from "./c.wasm"; +>c : Symbol(c, Decl(index.ts, 2, 6)) + +export type A = typeof a; +>A : Symbol(A, Decl(index.ts, 2, 32)) +>a : Symbol(a, Decl(index.ts, 0, 6)) + +export const d = c; +>d : Symbol(d, Decl(index.ts, 4, 12)) +>c : Symbol(c, Decl(index.ts, 2, 6)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).types b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).types new file mode 100644 index 0000000000000..5ae56f0418e00 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource21(verbatimmodulesyntax=true).types @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource21.ts] //// + +=== index.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +import source b from "./b.wasm"; +>b : AbstractModuleSource + +import source c from "./c.wasm"; +>c : AbstractModuleSource + +export type A = typeof a; +>A : AbstractModuleSource +>a : AbstractModuleSource + +export const d = c; +>d : AbstractModuleSource +>c : AbstractModuleSource + diff --git a/tsc/testdata/baselines/reference/conformance/importSource3.js b/tsc/testdata/baselines/reference/conformance/importSource3.js new file mode 100644 index 0000000000000..3e4d975402bb4 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource3.js @@ -0,0 +1,70 @@ +//// [tests/cases/conformance/importSource/importSource3.ts] //// + +//// [a.ts] +export default 1; +export const a = 2; + +//// [b.ts] +import source from "./a.js"; +const a: number = source; + +//// [c.ts] +import source, { a } from "./a.js"; +const b: number = source + a; + +//// [d.ts] +import source = require("./a"); +const a: typeof source = source; + +//// [e.ts] +const source = 1; +const a: number = source; + +//// [g.ts] +import source from from "./f.wasm"; +const a: AbstractModuleSource = from; + +//// [h.ts] +import source type from "./f.wasm"; +const a: AbstractModuleSource = type; + +//// [i.ts] +import source source from "./f.wasm"; +const a: AbstractModuleSource = source; + +//// [j.ts] +import +source +a +from "./f.wasm"; +const b: AbstractModuleSource = a; + + +//// [a.js] +export default 1; +export const a = 2; +//// [b.js] +import source from "./a.js"; +const a = source; +//// [c.js] +import source, { a } from "./a.js"; +const b = source + a; +//// [d.js] +const source = require("./a"); +const a = source; +//// [e.js] +"use strict"; +const source = 1; +const a = source; +//// [g.js] +import source from from "./f.wasm"; +const a = from; +//// [h.js] +import source type from "./f.wasm"; +const a = type; +//// [i.js] +import source source from "./f.wasm"; +const a = source; +//// [j.js] +import source a from "./f.wasm"; +const b = a; diff --git a/tsc/testdata/baselines/reference/conformance/importSource3.symbols b/tsc/testdata/baselines/reference/conformance/importSource3.symbols new file mode 100644 index 0000000000000..097022acf0454 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource3.symbols @@ -0,0 +1,81 @@ +//// [tests/cases/conformance/importSource/importSource3.ts] //// + +=== a.ts === +export default 1; +export const a = 2; +>a : Symbol(a, Decl(a.ts, 1, 12)) + +=== b.ts === +import source from "./a.js"; +>source : Symbol(source, Decl(b.ts, 0, 6)) + +const a: number = source; +>a : Symbol(a, Decl(b.ts, 1, 5)) +>source : Symbol(source, Decl(b.ts, 0, 6)) + +=== c.ts === +import source, { a } from "./a.js"; +>source : Symbol(source, Decl(c.ts, 0, 6)) +>a : Symbol(a, Decl(c.ts, 0, 16)) + +const b: number = source + a; +>b : Symbol(b, Decl(c.ts, 1, 5)) +>source : Symbol(source, Decl(c.ts, 0, 6)) +>a : Symbol(a, Decl(c.ts, 0, 16)) + +=== d.ts === +import source = require("./a"); +>source : Symbol(source, Decl(d.ts, 0, 0)) + +const a: typeof source = source; +>a : Symbol(a, Decl(d.ts, 1, 5)) +>source : Symbol(source, Decl(d.ts, 0, 0)) +>source : Symbol(source, Decl(d.ts, 0, 0)) + +=== e.ts === +const source = 1; +>source : Symbol(source, Decl(e.ts, 0, 5)) + +const a: number = source; +>a : Symbol(a, Decl(e.ts, 1, 5)) +>source : Symbol(source, Decl(e.ts, 0, 5)) + +=== g.ts === +import source from from "./f.wasm"; +>from : Symbol(from, Decl(g.ts, 0, 6)) + +const a: AbstractModuleSource = from; +>a : Symbol(a, Decl(g.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>from : Symbol(from, Decl(g.ts, 0, 6)) + +=== h.ts === +import source type from "./f.wasm"; +>type : Symbol(type, Decl(h.ts, 0, 6)) + +const a: AbstractModuleSource = type; +>a : Symbol(a, Decl(h.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>type : Symbol(type, Decl(h.ts, 0, 6)) + +=== i.ts === +import source source from "./f.wasm"; +>source : Symbol(source, Decl(i.ts, 0, 6)) + +const a: AbstractModuleSource = source; +>a : Symbol(a, Decl(i.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>source : Symbol(source, Decl(i.ts, 0, 6)) + +=== j.ts === +import +source +a +>a : Symbol(a, Decl(j.ts, 0, 6)) + +from "./f.wasm"; +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(j.ts, 4, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(j.ts, 0, 6)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource3.types b/tsc/testdata/baselines/reference/conformance/importSource3.types new file mode 100644 index 0000000000000..02c799d1bd17c --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource3.types @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/importSource/importSource3.ts] //// + +=== a.ts === +export default 1; +export const a = 2; +>a : 2 +>2 : 2 + +=== b.ts === +import source from "./a.js"; +>source : 1 + +const a: number = source; +>a : number +>source : 1 + +=== c.ts === +import source, { a } from "./a.js"; +>source : 1 +>a : 2 + +const b: number = source + a; +>b : number +>source + a : number +>source : 1 +>a : 2 + +=== d.ts === +import source = require("./a"); +>source : typeof source + +const a: typeof source = source; +>a : typeof source +>source : typeof source +>source : typeof source + +=== e.ts === +const source = 1; +>source : 1 +>1 : 1 + +const a: number = source; +>a : number +>source : 1 + +=== g.ts === +import source from from "./f.wasm"; +>from : AbstractModuleSource + +const a: AbstractModuleSource = from; +>a : AbstractModuleSource +>from : AbstractModuleSource + +=== h.ts === +import source type from "./f.wasm"; +>type : AbstractModuleSource + +const a: AbstractModuleSource = type; +>a : AbstractModuleSource +>type : AbstractModuleSource + +=== i.ts === +import source source from "./f.wasm"; +>source : AbstractModuleSource + +const a: AbstractModuleSource = source; +>a : AbstractModuleSource +>source : AbstractModuleSource + +=== j.ts === +import +source +a +>a : AbstractModuleSource + +from "./f.wasm"; +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + diff --git a/tsc/testdata/baselines/reference/conformance/importSource4.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource4.errors.txt new file mode 100644 index 0000000000000..1a261f9650e48 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource4.errors.txt @@ -0,0 +1,45 @@ +b.ts(1,8): error TS18112: Named and namespace imports are not allowed in a source phase import. +c.ts(1,8): error TS18112: Named and namespace imports are not allowed in a source phase import. +d.ts(1,8): error TS18112: Named and namespace imports are not allowed in a source phase import. +e.ts(1,8): error TS18111: A source phase import must specify a local binding. +f.ts(1,20): error TS1005: 'from' expected. +f.ts(1,20): error TS1141: String literal expected. +f.ts(1,22): error TS1005: ';' expected. +f.ts(1,22): error TS2304: Cannot find name 'from'. + + +==== a.ts (0 errors) ==== + export default 1; + export const a = 2; + +==== b.ts (1 errors) ==== + import source * as a from "./a.js"; + ~~~~~~~~~~~~~ +!!! error TS18112: Named and namespace imports are not allowed in a source phase import. + +==== c.ts (1 errors) ==== + import source { a } from "./a.js"; + ~~~~~~~~~~~~ +!!! error TS18112: Named and namespace imports are not allowed in a source phase import. + +==== d.ts (1 errors) ==== + import source a, { a as b } from "./a.js"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS18112: Named and namespace imports are not allowed in a source phase import. + +==== e.ts (1 errors) ==== + import source "./a.js"; + ~~~~~~ +!!! error TS18111: A source phase import must specify a local binding. + +==== f.ts (4 errors) ==== + import source type a from "./a.js"; + ~ +!!! error TS1005: 'from' expected. + ~ +!!! error TS1141: String literal expected. + ~~~~ +!!! error TS1005: ';' expected. + ~~~~ +!!! error TS2304: Cannot find name 'from'. + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource4.js b/tsc/testdata/baselines/reference/conformance/importSource4.js new file mode 100644 index 0000000000000..236ebcde632d8 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource4.js @@ -0,0 +1,37 @@ +//// [tests/cases/conformance/importSource/importSource4.ts] //// + +//// [a.ts] +export default 1; +export const a = 2; + +//// [b.ts] +import source * as a from "./a.js"; + +//// [c.ts] +import source { a } from "./a.js"; + +//// [d.ts] +import source a, { a as b } from "./a.js"; + +//// [e.ts] +import source "./a.js"; + +//// [f.ts] +import source type a from "./a.js"; + + +//// [a.js] +export default 1; +export const a = 2; +//// [b.js] +export {}; +//// [c.js] +export {}; +//// [d.js] +export {}; +//// [e.js] +export {}; +//// [f.js] +from; +"./a.js"; +export {}; diff --git a/tsc/testdata/baselines/reference/conformance/importSource4.symbols b/tsc/testdata/baselines/reference/conformance/importSource4.symbols new file mode 100644 index 0000000000000..dbf0aef0d7603 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource4.symbols @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/importSource/importSource4.ts] //// + +=== a.ts === +export default 1; +export const a = 2; +>a : Symbol(a, Decl(a.ts, 1, 12)) + +=== b.ts === +import source * as a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 13)) + +=== c.ts === +import source { a } from "./a.js"; +>a : Symbol(a, Decl(c.ts, 0, 15)) + +=== d.ts === +import source a, { a as b } from "./a.js"; +>a : Symbol(a, Decl(d.ts, 0, 6)) +>b : Symbol(b, Decl(d.ts, 0, 18)) + +=== e.ts === + +import source "./a.js"; + +=== f.ts === +import source type a from "./a.js"; +>type : Symbol(type, Decl(f.ts, 0, 6)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource4.types b/tsc/testdata/baselines/reference/conformance/importSource4.types new file mode 100644 index 0000000000000..e4713e04cc159 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource4.types @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/importSource/importSource4.ts] //// + +=== a.ts === +export default 1; +export const a = 2; +>a : 2 +>2 : 2 + +=== b.ts === +import source * as a from "./a.js"; +>a : any + +=== c.ts === +import source { a } from "./a.js"; +>a : any + +=== d.ts === +import source a, { a as b } from "./a.js"; +>a : AbstractModuleSource +>a : any +>b : any + +=== e.ts === + +import source "./a.js"; + +=== f.ts === +import source type a from "./a.js"; +>type : AbstractModuleSource +>a : any +>from : any +>"./a.js" : "./a.js" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource5.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource5.errors.txt new file mode 100644 index 0000000000000..ef9bb26264f5f --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource5.errors.txt @@ -0,0 +1,71 @@ +b.ts(1,14): error TS1005: '(' expected. +b.ts(2,15): error TS1005: '(' expected. +b.ts(3,23): error TS1005: '(' expected. +b.ts(4,14): error TS1005: '(' expected. +b.ts(6,1): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +b.ts(7,1): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments +b.ts(8,14): error TS18114: Optional chaining cannot be used with 'import.source'. +b.ts(9,1): error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments. +b.ts(10,15): error TS1325: Argument of dynamic import cannot be spread element. +c.ts(1,5): error TS1109: Expression expected. +d.ts(1,5): error TS1109: Expression expected. +d.ts(1,29): error TS2339: Property 'a' does not exist on type 'Promise'. +e.ts(1,21): error TS1005: '(' expected. +f.ts(1,8): error TS18061: 'a' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'? + + +==== a.ts (0 errors) ==== + export default 1; + +==== b.ts (9 errors) ==== + import.source; + +!!! error TS1005: '(' expected. + (import.source)("./a.js"); + +!!! error TS1005: '(' expected. + Function(import.source); + +!!! error TS1005: '(' expected. + import.source.unknown; + +!!! error TS1005: '(' expected. + + import.source(); + ~~~~~~~~~~~~~~~ +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + import.source("./a.js", {}, {}); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments + import.source?.("./a.js"); + ~~ +!!! error TS18114: Optional chaining cannot be used with 'import.source'. + import.source("./a.js"); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments. + import.source(...["./a.js"]); + ~~~~~~~~~~~~~ +!!! error TS1325: Argument of dynamic import cannot be spread element. + +==== c.ts (1 errors) ==== + new import.source("./a.js"); + ~~~~~~ +!!! error TS1109: Expression expected. + +==== d.ts (2 errors) ==== + new import.source("./a.js").a; + ~~~~~~ +!!! error TS1109: Expression expected. + ~ +!!! error TS2339: Property 'a' does not exist on type 'Promise'. + +==== e.ts (1 errors) ==== + typeof import.source; + +!!! error TS1005: '(' expected. + +==== f.ts (1 errors) ==== + import.a("./a.js"); + ~ +!!! error TS18061: 'a' is not a valid meta-property for keyword 'import'. Did you mean 'meta', 'defer', or 'source'? + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource5.js b/tsc/testdata/baselines/reference/conformance/importSource5.js new file mode 100644 index 0000000000000..2a4cb481a388d --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource5.js @@ -0,0 +1,57 @@ +//// [tests/cases/conformance/importSource/importSource5.ts] //// + +//// [a.ts] +export default 1; + +//// [b.ts] +import.source; +(import.source)("./a.js"); +Function(import.source); +import.source.unknown; + +import.source(); +import.source("./a.js", {}, {}); +import.source?.("./a.js"); +import.source("./a.js"); +import.source(...["./a.js"]); + +//// [c.ts] +new import.source("./a.js"); + +//// [d.ts] +new import.source("./a.js").a; + +//// [e.ts] +typeof import.source; + +//// [f.ts] +import.a("./a.js"); + + +//// [a.js] +export default 1; +//// [b.js] +"use strict"; +import.source; +(import.source)("./a.js"); +Function(import.source); +import.source.unknown; +import.source(); +import.source("./a.js", {}, {}); +import.source?.("./a.js"); +import.source("./a.js"); +import.source(...["./a.js"]); +//// [c.js] +"use strict"; +new ; +import.source("./a.js"); +//// [d.js] +"use strict"; +new ; +import.source("./a.js").a; +//// [e.js] +"use strict"; +typeof import.source; +//// [f.js] +"use strict"; +import.a("./a.js"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource5.symbols b/tsc/testdata/baselines/reference/conformance/importSource5.symbols new file mode 100644 index 0000000000000..310e69196d322 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource5.symbols @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/importSource/importSource5.ts] //// + +=== a.ts === + +export default 1; + +=== b.ts === +import.source; +(import.source)("./a.js"); +Function(import.source); +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.esnext.decorators.d.ts, --, --)) + +import.source.unknown; + +import.source(); +import.source("./a.js", {}, {}); +import.source?.("./a.js"); +import.source("./a.js"); +import.source(...["./a.js"]); + +=== c.ts === + +new import.source("./a.js"); + +=== d.ts === + +new import.source("./a.js").a; + +=== e.ts === + +typeof import.source; + +=== f.ts === + +import.a("./a.js"); + diff --git a/tsc/testdata/baselines/reference/conformance/importSource5.types b/tsc/testdata/baselines/reference/conformance/importSource5.types new file mode 100644 index 0000000000000..e8654b6742dcb --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource5.types @@ -0,0 +1,89 @@ +//// [tests/cases/conformance/importSource/importSource5.ts] //// + +=== a.ts === + +export default 1; + +=== b.ts === +import.source; +>import.source : any +>source : any + +(import.source)("./a.js"); +>(import.source)("./a.js") : any +>(import.source) : any +>import.source : any +>source : any +>"./a.js" : "./a.js" + +Function(import.source); +>Function(import.source) : Function +>Function : FunctionConstructor +>import.source : any +>source : any + +import.source.unknown; +>import.source.unknown : any +>import.source : any +>source : any +>unknown : any + +import.source(); +>import.source() : Promise +>source : any + +import.source("./a.js", {}, {}); +>import.source("./a.js", {}, {}) : Promise +>source : any +>"./a.js" : "./a.js" +>{} : {} +>{} : {} + +import.source?.("./a.js"); +>import.source?.("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + +import.source("./a.js"); +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + +import.source(...["./a.js"]); +>import.source(...["./a.js"]) : Promise +>source : any +>...["./a.js"] : string +>["./a.js"] : [string] +>"./a.js" : "./a.js" + +=== c.ts === +new import.source("./a.js"); +>new : any +> : any +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + +=== d.ts === +new import.source("./a.js").a; +>new : any +> : any +>import.source("./a.js").a : any +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" +>a : any + +=== e.ts === +typeof import.source; +>typeof import.source : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" +>import.source : any +>source : any + +=== f.ts === +import.a("./a.js"); +>import.a("./a.js") : any +>import.a : any +>a : any +>"./a.js" : "./a.js" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource6.errors.txt b/tsc/testdata/baselines/reference/conformance/importSource6.errors.txt new file mode 100644 index 0000000000000..744a8df4df159 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource6.errors.txt @@ -0,0 +1,15 @@ +b.ts(1,8): error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. +b.ts(2,11): error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. + + +==== a.ts (0 errors) ==== + export default 1; + +==== b.ts (2 errors) ==== + import source a from "./a.js"; + ~~~~~~~~ +!!! error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. + const b = import.source("./a.js"); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS18113: Source phase imports are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'. + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/conformance/importSource6.js b/tsc/testdata/baselines/reference/conformance/importSource6.js new file mode 100644 index 0000000000000..b8fc0906bed90 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource6.js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/importSource/importSource6.ts] //// + +//// [a.ts] +export default 1; + +//// [b.ts] +import source a from "./a.js"; +const b = import.source("./a.js"); + + +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = 1; +//// [b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const b = import.source("./a.js"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource6.symbols b/tsc/testdata/baselines/reference/conformance/importSource6.symbols new file mode 100644 index 0000000000000..00c36944f79c5 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource6.symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/importSource/importSource6.ts] //// + +=== a.ts === + +export default 1; + +=== b.ts === +import source a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + +const b = import.source("./a.js"); +>b : Symbol(b, Decl(b.ts, 1, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource6.types b/tsc/testdata/baselines/reference/conformance/importSource6.types new file mode 100644 index 0000000000000..84cca88c0a85a --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource6.types @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/importSource/importSource6.ts] //// + +=== a.ts === + +export default 1; + +=== b.ts === +import source a from "./a.js"; +>a : AbstractModuleSource + +const b = import.source("./a.js"); +>b : Promise +>import.source("./a.js") : Promise +>source : any +>"./a.js" : "./a.js" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource7.js b/tsc/testdata/baselines/reference/conformance/importSource7.js new file mode 100644 index 0000000000000..3daa37201cc24 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource7.js @@ -0,0 +1,20 @@ +//// [tests/cases/conformance/importSource/importSource7.ts] //// + +//// [a.d.wasm.ts] +export const a: number; + +//// [b.ts] +import { a } from "./a.wasm"; +import source b from "./a.wasm"; + +const c: number = a; +const d: AbstractModuleSource = b; +const e: Promise = import.source("./a.wasm"); + + +//// [b.js] +import { a } from "./a.wasm"; +import source b from "./a.wasm"; +const c = a; +const d = b; +const e = import.source("./a.wasm"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource7.symbols b/tsc/testdata/baselines/reference/conformance/importSource7.symbols new file mode 100644 index 0000000000000..d3ad92e68b126 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource7.symbols @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/importSource/importSource7.ts] //// + +=== a.d.wasm.ts === +export const a: number; +>a : Symbol(a, Decl(a.d.wasm.ts, 0, 12)) + +=== b.ts === +import { a } from "./a.wasm"; +>a : Symbol(a, Decl(b.ts, 0, 8)) + +import source b from "./a.wasm"; +>b : Symbol(b, Decl(b.ts, 1, 6)) + +const c: number = a; +>c : Symbol(c, Decl(b.ts, 3, 5)) +>a : Symbol(a, Decl(b.ts, 0, 8)) + +const d: AbstractModuleSource = b; +>d : Symbol(d, Decl(b.ts, 4, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>b : Symbol(b, Decl(b.ts, 1, 6)) + +const e: Promise = import.source("./a.wasm"); +>e : Symbol(e, Decl(b.ts, 5, 5)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource7.types b/tsc/testdata/baselines/reference/conformance/importSource7.types new file mode 100644 index 0000000000000..db838a68b0a7e --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource7.types @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/importSource/importSource7.ts] //// + +=== a.d.wasm.ts === +export const a: number; +>a : number + +=== b.ts === +import { a } from "./a.wasm"; +>a : number + +import source b from "./a.wasm"; +>b : AbstractModuleSource + +const c: number = a; +>c : number +>a : number + +const d: AbstractModuleSource = b; +>d : AbstractModuleSource +>b : AbstractModuleSource + +const e: Promise = import.source("./a.wasm"); +>e : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource8.js b/tsc/testdata/baselines/reference/conformance/importSource8.js new file mode 100644 index 0000000000000..054842d4f3972 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource8.js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/importSource/importSource8.ts] //// + +//// [b.ts] +/*comment a*/ import /*comment b*/ source /*comment c*/ a /*comment d*/ from /*comment e*/ "./a.wasm" /*comment f*/ with /*comment g*/ { type: "webassembly" } /*comment h*/; +const b = a; +const c = import /*comment i*/ . /*comment j*/ source /*comment k*/ ("./a.wasm"); + + +//// [b.js] +/*comment a*/ import /*comment b*/ source /*comment c*/ a /*comment d*/ from /*comment e*/ "./a.wasm" /*comment f*/ with /*comment g*/ { type: "webassembly" } /*comment h*/; +const b = a; +const c = import /*comment i*/. /*comment j*/source /*comment k*/("./a.wasm"); diff --git a/tsc/testdata/baselines/reference/conformance/importSource8.symbols b/tsc/testdata/baselines/reference/conformance/importSource8.symbols new file mode 100644 index 0000000000000..b8ae213ec303e --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource8.symbols @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/importSource/importSource8.ts] //// + +=== b.ts === +/*comment a*/ import /*comment b*/ source /*comment c*/ a /*comment d*/ from /*comment e*/ "./a.wasm" /*comment f*/ with /*comment g*/ { type: "webassembly" } /*comment h*/; +>a : Symbol(a, Decl(b.ts, 0, 20)) + +const b = a; +>b : Symbol(b, Decl(b.ts, 1, 5)) +>a : Symbol(a, Decl(b.ts, 0, 20)) + +const c = import /*comment i*/ . /*comment j*/ source /*comment k*/ ("./a.wasm"); +>c : Symbol(c, Decl(b.ts, 2, 5)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource8.types b/tsc/testdata/baselines/reference/conformance/importSource8.types new file mode 100644 index 0000000000000..499590e1dcbbd --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource8.types @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/importSource/importSource8.ts] //// + +=== b.ts === +/*comment a*/ import /*comment b*/ source /*comment c*/ a /*comment d*/ from /*comment e*/ "./a.wasm" /*comment f*/ with /*comment g*/ { type: "webassembly" } /*comment h*/; +>a : AbstractModuleSource +>type : error + +const b = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +const c = import /*comment i*/ . /*comment j*/ source /*comment k*/ ("./a.wasm"); +>c : Promise +>import /*comment i*/ . /*comment j*/ source /*comment k*/ ("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + diff --git a/tsc/testdata/baselines/reference/conformance/importSource9.js b/tsc/testdata/baselines/reference/conformance/importSource9.js new file mode 100644 index 0000000000000..f681f9e2264fc --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource9.js @@ -0,0 +1,44 @@ +//// [tests/cases/conformance/importSource/importSource9.ts] //// + +//// [b.ts] +import source a from "./a.wasm"; +export { a }; + +//// [c.ts] +import { a } from "./b.js"; +const b: AbstractModuleSource = a; + +//// [d.ts] +import * as a from "./b.js"; +const b: AbstractModuleSource = a.a; + +//// [e.ts] +import source a from "./a.wasm"; +export type B = typeof a; +export const b = import.source("./a.wasm"); + + +//// [b.js] +import source a from "./a.wasm"; +export { a }; +//// [c.js] +import { a } from "./b.js"; +const b = a; +//// [d.js] +import * as a from "./b.js"; +const b = a.a; +//// [e.js] +export const b = import.source("./a.wasm"); + + +//// [b.d.ts] +import source a from "./a.wasm"; +export { a }; +//// [c.d.ts] +export {}; +//// [d.d.ts] +export {}; +//// [e.d.ts] +import source a from "./a.wasm"; +export type B = typeof a; +export declare const b: Promise; diff --git a/tsc/testdata/baselines/reference/conformance/importSource9.symbols b/tsc/testdata/baselines/reference/conformance/importSource9.symbols new file mode 100644 index 0000000000000..68a94da4e0e29 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource9.symbols @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/importSource/importSource9.ts] //// + +=== b.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + +export { a }; +>a : Symbol(a, Decl(b.ts, 1, 8)) + +=== c.ts === +import { a } from "./b.js"; +>a : Symbol(a, Decl(c.ts, 0, 8)) + +const b: AbstractModuleSource = a; +>b : Symbol(b, Decl(c.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a : Symbol(a, Decl(c.ts, 0, 8)) + +=== d.ts === +import * as a from "./b.js"; +>a : Symbol(a, Decl(d.ts, 0, 6)) + +const b: AbstractModuleSource = a.a; +>b : Symbol(b, Decl(d.ts, 1, 5)) +>AbstractModuleSource : Symbol(AbstractModuleSource, Decl(lib.esnext.modulesource.d.ts, --, --)) +>a.a : Symbol(a.a, Decl(b.ts, 1, 8)) +>a : Symbol(a, Decl(d.ts, 0, 6)) +>a : Symbol(a.a, Decl(b.ts, 1, 8)) + +=== e.ts === +import source a from "./a.wasm"; +>a : Symbol(a, Decl(e.ts, 0, 6)) + +export type B = typeof a; +>B : Symbol(B, Decl(e.ts, 0, 32)) +>a : Symbol(a, Decl(e.ts, 0, 6)) + +export const b = import.source("./a.wasm"); +>b : Symbol(b, Decl(e.ts, 2, 12)) + diff --git a/tsc/testdata/baselines/reference/conformance/importSource9.types b/tsc/testdata/baselines/reference/conformance/importSource9.types new file mode 100644 index 0000000000000..040f188c64190 --- /dev/null +++ b/tsc/testdata/baselines/reference/conformance/importSource9.types @@ -0,0 +1,41 @@ +//// [tests/cases/conformance/importSource/importSource9.ts] //// + +=== b.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +export { a }; +>a : AbstractModuleSource + +=== c.ts === +import { a } from "./b.js"; +>a : AbstractModuleSource + +const b: AbstractModuleSource = a; +>b : AbstractModuleSource +>a : AbstractModuleSource + +=== d.ts === +import * as a from "./b.js"; +>a : typeof a + +const b: AbstractModuleSource = a.a; +>b : AbstractModuleSource +>a.a : AbstractModuleSource +>a : typeof a +>a : AbstractModuleSource + +=== e.ts === +import source a from "./a.wasm"; +>a : AbstractModuleSource + +export type B = typeof a; +>B : AbstractModuleSource +>a : AbstractModuleSource + +export const b = import.source("./a.wasm"); +>b : Promise +>import.source("./a.wasm") : Promise +>source : any +>"./a.wasm" : "./a.wasm" + diff --git a/tsc/testdata/baselines/reference/fourslash/findAllReferences/goToDefinition_sourcePhase.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/findAllReferences/goToDefinition_sourcePhase.baseline.jsonc new file mode 100644 index 0000000000000..91a7d391041e1 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/findAllReferences/goToDefinition_sourcePhase.baseline.jsonc @@ -0,0 +1,29 @@ +// === findAllReferences === +// === /b.ts === +// import source [|b|] from "./a.wasm"; +// /*FIND ALL REFS*/[|b|]; +// export { [|b|] }; +// + +// === /d.ts === +// import { [|b|] as [|d|] } from "./b"; +// [|d|]; +// + +// === /e.ts === +// export { [|b|] as [|e|] } from "./b"; +// + +// === /f.ts === +// import { [|e|] as [|f|] } from "./e"; +// [|f|]; +// import * as ns from "./e"; +// ns.[|e|]; + + + +// === findAllReferences === +// === /c.ts === +// import source [|c|] from "./a.wasm"; +// /*FIND ALL REFS*/[|c|]; +// \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/findAllReferences/referencesImportSource.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/findAllReferences/referencesImportSource.baseline.jsonc new file mode 100644 index 0000000000000..0ee3c92c1e9b0 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/findAllReferences/referencesImportSource.baseline.jsonc @@ -0,0 +1,75 @@ +// === findAllReferences === +// === /a.d.ts === +// declare module "m" { +// export default function /*FIND ALL REFS*/[|f|](): void; +// } +// + +// === /b.ts === +// import [|f|] from "m"; +// [|f|](); +// + + + +// === findAllReferences === +// === /a.d.ts === +// declare module "m" { +// export default function [|f|](): void; +// } +// + +// === /b.ts === +// import /*FIND ALL REFS*/[|f|] from "m"; +// [|f|](); +// + + + +// === findAllReferences === +// === /c.ts === +// import source /*FIND ALL REFS*/[|f|] from "m"; +// [|f|]; +// export { [|f|] }; +// + +// === /d.ts === +// import { [|f|] } from "./c"; +// [|f|]; +// + + + +// === findAllReferences === +// === /c.ts === +// import source [|f|] from "m"; +// /*FIND ALL REFS*/[|f|]; +// export { [|f|] }; +// + +// === /d.ts === +// import { [|f|] } from "./c"; +// [|f|]; +// + + + +// === findAllReferences === +// === /c.ts === +// import source [|f|] from "m"; +// [|f|]; +// export { [|f|] }; +// + +// === /d.ts === +// import { /*FIND ALL REFS*/[|f|] } from "./c"; +// [|f|]; +// + + + +// === findAllReferences === +// === /e.ts === +// import source /*FIND ALL REFS*/[|g|] from "m"; +// [|g|]; +// import.source("m"); \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/findAllReferences/referencesImportSource2.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/findAllReferences/referencesImportSource2.baseline.jsonc new file mode 100644 index 0000000000000..272f9008094f4 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/findAllReferences/referencesImportSource2.baseline.jsonc @@ -0,0 +1,42 @@ +// === findAllReferences === +// === /a.js === +// export default function /*FIND ALL REFS*/[|f|]() {} +// + +// === /b.ts === +// import [|f|] from "./a.js"; +// [|f|](); +// + + + +// === findAllReferences === +// === /a.js === +// export default function [|f|]() {} +// + +// === /b.ts === +// import /*FIND ALL REFS*/[|f|] from "./a.js"; +// [|f|](); +// + + + +// === findAllReferences === +// === /c.ts === +// import source /*FIND ALL REFS*/[|f|] from "./a.js"; +// [|f|]; +// import.source("./a.js"); + + + +// === findAllReferences === +// === /b.ts === +// import f from "[|./a.js|]"; +// f(); +// + +// === /c.ts === +// import source f from "/*FIND ALL REFS*/[|./a.js|]"; +// f; +// import.source("[|./a.js|]"); \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/findRenameLocations/referencesImportSource.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/findRenameLocations/referencesImportSource.baseline.jsonc new file mode 100644 index 0000000000000..85f8dcceeb437 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/findRenameLocations/referencesImportSource.baseline.jsonc @@ -0,0 +1,53 @@ +// === findRenameLocations === +// === /a.d.ts === +// declare module "m" { +// export default function /*RENAME*/[|fRENAME|](): void; +// } +// + +// === /b.ts === +// import [|fRENAME|] from "m"; +// [|fRENAME|](); +// + + + +// === findRenameLocations === +// === /b.ts === +// import /*RENAME*/[|fRENAME|] from "m"; +// [|fRENAME|](); +// + + + +// === findRenameLocations === +// === /c.ts === +// import source /*RENAME*/[|fRENAME|] from "m"; +// [|fRENAME|]; +// export { [|fRENAME|] as f/*END SUFFIX*/ }; +// + + + +// === findRenameLocations === +// === /c.ts === +// import source [|fRENAME|] from "m"; +// /*RENAME*/[|fRENAME|]; +// export { [|fRENAME|] as f/*END SUFFIX*/ }; +// + + + +// === findRenameLocations === +// === /d.ts === +// import { /*START PREFIX*/f as /*RENAME*/[|fRENAME|] } from "./c"; +// [|fRENAME|]; +// + + + +// === findRenameLocations === +// === /e.ts === +// import source /*RENAME*/[|gRENAME|] from "m"; +// [|gRENAME|]; +// import.source("m"); \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/findRenameLocations/referencesImportSource2.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/findRenameLocations/referencesImportSource2.baseline.jsonc new file mode 100644 index 0000000000000..1ca0cf9188c08 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/findRenameLocations/referencesImportSource2.baseline.jsonc @@ -0,0 +1,25 @@ +// === findRenameLocations === +// === /a.js === +// export default function /*RENAME*/[|fRENAME|]() {} +// + +// === /b.ts === +// import [|fRENAME|] from "./a.js"; +// [|fRENAME|](); +// + + + +// === findRenameLocations === +// === /b.ts === +// import /*RENAME*/[|fRENAME|] from "./a.js"; +// [|fRENAME|](); +// + + + +// === findRenameLocations === +// === /c.ts === +// import source /*RENAME*/[|fRENAME|] from "./a.js"; +// [|fRENAME|]; +// import.source("./a.js"); \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_sourcePhase.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_sourcePhase.baseline.jsonc new file mode 100644 index 0000000000000..1a90f20eaa537 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/goToDefinition/goToDefinition_sourcePhase.baseline.jsonc @@ -0,0 +1,85 @@ +// === goToDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// /*GOTO DEF*/b; +// export { b }; +// + + + +// === goToDefinition === +// === /c.ts === +// <|import source [|c|] from "./a.wasm";|> +// /*GOTO DEF*/c; +// + + + +// === goToDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /d.ts === +// import { /*GOTO DEF*/[|b|] as d } from "./b"; +// d; +// + + + +// === goToDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /d.ts === +// import { b as d } from "./b"; +// /*GOTO DEF*/[|d|]; +// + + + +// === goToDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /e.ts === +// export { b as /*GOTO DEF*/[|e|] } from "./b"; +// + + + +// === goToDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /f.ts === +// import { e as f } from "./e"; +// /*GOTO DEF*/[|f|]; +// import * as ns from "./e"; +// ns.e; + + + +// === goToDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /f.ts === +// import { e as f } from "./e"; +// f; +// import * as ns from "./e"; +// ns./*GOTO DEF*/[|e|]; \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/goToDefinition/goToSourceDefinitionImportSource.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/goToDefinition/goToSourceDefinitionImportSource.baseline.jsonc new file mode 100644 index 0000000000000..064ae39606564 --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/goToDefinition/goToSourceDefinitionImportSource.baseline.jsonc @@ -0,0 +1,113 @@ +// === goToDefinition === +// === /a.js === +// const x = 1; +// <|export default function [|f|]() {}|> +// const g = 2; +// + +// === /b.ts === +// import /*GOTO DEF*/[|f|] from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// --- (line: 5) skipped --- + + + +// === goToDefinition === +// === /a.js === +// const x = 1; +// <|export default function [|f|]() {}|> +// const g = 2; +// + +// === /b.ts === +// import f from "./a.js"; +// /*GOTO DEF*/[|f|](); +// import source g from "./a.js"; +// g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// <|import source /*GOTO DEF*/[|g|] from "./a.js";|> +// g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// <|import source [|g|] from "./a.js";|> +// /*GOTO DEF*/g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// <|import source /*GOTO DEF*/[|h|] from "./a.wasm";|> +// h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// <|import source [|h|] from "./a.wasm";|> +// /*GOTO DEF*/h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "/*GOTO DEF*/./a.js"; +// g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// import source h from "/*GOTO DEF*/./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToDefinition === +// === /b.ts === +// --- (line: 3) skipped --- +// g; +// import source h from "./a.wasm"; +// h; +// import.source("/*GOTO DEF*/./a.js"); \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/goToSourceDefinition/goToDefinition_sourcePhase.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/goToSourceDefinition/goToDefinition_sourcePhase.baseline.jsonc new file mode 100644 index 0000000000000..e1e0d1822c7fa --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/goToSourceDefinition/goToDefinition_sourcePhase.baseline.jsonc @@ -0,0 +1,85 @@ +// === goToSourceDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// /*GOTO SOURCE DEF*/b; +// export { b }; +// + + + +// === goToSourceDefinition === +// === /c.ts === +// <|import source [|c|] from "./a.wasm";|> +// /*GOTO SOURCE DEF*/c; +// + + + +// === goToSourceDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// <|export { [|b|] };|> +// + +// === /d.ts === +// import { /*GOTO SOURCE DEF*/b as d } from "./b"; +// d; +// + + + +// === goToSourceDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /d.ts === +// import { b as d } from "./b"; +// /*GOTO SOURCE DEF*/d; +// + + + +// === goToSourceDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// <|export { [|b|] };|> +// + +// === /e.ts === +// export { b as /*GOTO SOURCE DEF*/e } from "./b"; +// + + + +// === goToSourceDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /f.ts === +// import { e as f } from "./e"; +// /*GOTO SOURCE DEF*/f; +// import * as ns from "./e"; +// ns.e; + + + +// === goToSourceDefinition === +// === /b.ts === +// <|import source [|b|] from "./a.wasm";|> +// b; +// export { b }; +// + +// === /f.ts === +// import { e as f } from "./e"; +// f; +// import * as ns from "./e"; +// ns./*GOTO SOURCE DEF*/e; \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionImportSource.baseline.jsonc b/tsc/testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionImportSource.baseline.jsonc new file mode 100644 index 0000000000000..6c33a38020aed --- /dev/null +++ b/tsc/testdata/baselines/reference/fourslash/goToSourceDefinition/goToSourceDefinitionImportSource.baseline.jsonc @@ -0,0 +1,113 @@ +// === goToSourceDefinition === +// === /a.js === +// const x = 1; +// <|export default function [|f|]() {}|> +// const g = 2; +// + +// === /b.ts === +// import /*GOTO SOURCE DEF*/f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// --- (line: 5) skipped --- + + + +// === goToSourceDefinition === +// === /a.js === +// const x = 1; +// <|export default function [|f|]() {}|> +// const g = 2; +// + +// === /b.ts === +// import f from "./a.js"; +// /*GOTO SOURCE DEF*/f(); +// import source g from "./a.js"; +// g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// <|import source /*GOTO SOURCE DEF*/[|g|] from "./a.js";|> +// g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// <|import source [|g|] from "./a.js";|> +// /*GOTO SOURCE DEF*/g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// <|import source /*GOTO SOURCE DEF*/[|h|] from "./a.wasm";|> +// h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// <|import source [|h|] from "./a.wasm";|> +// /*GOTO SOURCE DEF*/h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "/*GOTO SOURCE DEF*/./a.js"; +// g; +// import source h from "./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// import f from "./a.js"; +// f(); +// import source g from "./a.js"; +// g; +// import source h from "/*GOTO SOURCE DEF*/./a.wasm"; +// h; +// import.source("./a.js"); + + + +// === goToSourceDefinition === +// === /b.ts === +// --- (line: 3) skipped --- +// g; +// import source h from "./a.wasm"; +// h; +// import.source("/*GOTO SOURCE DEF*/./a.js"); \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/tsc/commandLine/Initialized-TSConfig-with-incorrect-compiler-option-value.js b/tsc/testdata/baselines/reference/tsc/commandLine/Initialized-TSConfig-with-incorrect-compiler-option-value.js index 6edd644d80394..aeb857466facc 100644 --- a/tsc/testdata/baselines/reference/tsc/commandLine/Initialized-TSConfig-with-incorrect-compiler-option-value.js +++ b/tsc/testdata/baselines/reference/tsc/commandLine/Initialized-TSConfig-with-incorrect-compiler-option-value.js @@ -5,5 +5,5 @@ Input:: tsgo --init --lib nonExistLib,es5,es2015.promise ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'es2025', 'es2026', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.arraybuffer', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'es2023.intl', 'es2024.arraybuffer', 'es2024.collection', 'es2024.object', 'es2024.promise', 'es2024.regexp', 'es2024.sharedmemory', 'es2024.string', 'es2025.collection', 'es2025.float16', 'es2025.intl', 'es2025.iterator', 'es2025.promise', 'es2025.regexp', 'es2026.array', 'es2026.collection', 'es2026.error', 'es2026.iterator', 'es2026.json', 'es2026.math', 'es2026.typedarrays', 'esnext.asynciterable', 'esnext.symbol', 'esnext.bigint', 'esnext.weakref', 'esnext.object', 'esnext.regexp', 'esnext.string', 'esnext.float16', 'esnext.array', 'esnext.collection', 'esnext.error', 'esnext.iterator', 'esnext.typedarrays', 'esnext.promise', 'esnext.date', 'esnext.decorators', 'esnext.disposable', 'esnext.intl', 'esnext.sharedmemory', 'esnext.temporal', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'es2025', 'es2026', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.arraybuffer', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'es2023.intl', 'es2024.arraybuffer', 'es2024.collection', 'es2024.object', 'es2024.promise', 'es2024.regexp', 'es2024.sharedmemory', 'es2024.string', 'es2025.collection', 'es2025.float16', 'es2025.intl', 'es2025.iterator', 'es2025.promise', 'es2025.regexp', 'es2026.array', 'es2026.collection', 'es2026.error', 'es2026.iterator', 'es2026.json', 'es2026.math', 'es2026.typedarrays', 'esnext.asynciterable', 'esnext.symbol', 'esnext.bigint', 'esnext.weakref', 'esnext.object', 'esnext.regexp', 'esnext.string', 'esnext.float16', 'esnext.array', 'esnext.collection', 'esnext.error', 'esnext.iterator', 'esnext.typedarrays', 'esnext.promise', 'esnext.date', 'esnext.decorators', 'esnext.disposable', 'esnext.intl', 'esnext.modulesource', 'esnext.sharedmemory', 'esnext.temporal', 'decorators', 'decorators.legacy'. diff --git a/tsc/testdata/baselines/reference/tsc/commandLine/help-all.js b/tsc/testdata/baselines/reference/tsc/commandLine/help-all.js index 57d00bbbe873d..301e860c2930d 100644 --- a/tsc/testdata/baselines/reference/tsc/commandLine/help-all.js +++ b/tsc/testdata/baselines/reference/tsc/commandLine/help-all.js @@ -545,7 +545,7 @@ default: react --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy default: undefined --libReplacement diff --git a/tsc/testdata/baselines/reference/tsc/commandLine/help.js b/tsc/testdata/baselines/reference/tsc/commandLine/help.js index 8e02b55bed9c8..a32bd869cc770 100644 --- a/tsc/testdata/baselines/reference/tsc/commandLine/help.js +++ b/tsc/testdata/baselines/reference/tsc/commandLine/help.js @@ -104,7 +104,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy default: undefined --allowJs diff --git a/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js b/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js index 0eac1e69a6afa..e6b6e5dd487a2 100644 --- a/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js +++ b/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js @@ -105,7 +105,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy default: undefined --allowJs diff --git a/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index f9a6e636dd4c2..95b2e5e844d0e 100644 --- a/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tsc/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -141,8 +141,8 @@ tsc: The TypeScript Compiler - Version FakeTSVersion s2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esn ext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026 .math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, e - snext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.leg - acy + snext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decor + ators, decorators.legacy default: undefined diff --git a/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent-with---ignoreConfig.js b/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent-with---ignoreConfig.js index fea2e5d8c5251..8c1c4fb75d449 100644 --- a/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent-with---ignoreConfig.js +++ b/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent-with---ignoreConfig.js @@ -111,7 +111,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy default: undefined --allowJs diff --git a/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent.js b/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent.js index 300243731f98b..3cd81172e132f 100644 --- a/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent.js +++ b/tsc/testdata/baselines/reference/tsc/ignoreConfig/without-any-options-when-config-file-absent.js @@ -111,7 +111,7 @@ default: undefined --lib Specify a set of bundled library declaration files that describe the target runtime environment. -one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy +one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy default: undefined --allowJs diff --git a/tsc/testdata/baselines/reference/tsc/showConfig/Show-TSConfig-with-incorrect-compiler-option-value.js b/tsc/testdata/baselines/reference/tsc/showConfig/Show-TSConfig-with-incorrect-compiler-option-value.js index d25f163698ac2..335cf82e61d08 100644 --- a/tsc/testdata/baselines/reference/tsc/showConfig/Show-TSConfig-with-incorrect-compiler-option-value.js +++ b/tsc/testdata/baselines/reference/tsc/showConfig/Show-TSConfig-with-incorrect-compiler-option-value.js @@ -5,5 +5,5 @@ Input:: tsgo --showConfig --lib nonExistLib,es5,es2015.promise ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'es2025', 'es2026', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.arraybuffer', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'es2023.intl', 'es2024.arraybuffer', 'es2024.collection', 'es2024.object', 'es2024.promise', 'es2024.regexp', 'es2024.sharedmemory', 'es2024.string', 'es2025.collection', 'es2025.float16', 'es2025.intl', 'es2025.iterator', 'es2025.promise', 'es2025.regexp', 'es2026.array', 'es2026.collection', 'es2026.error', 'es2026.iterator', 'es2026.json', 'es2026.math', 'es2026.typedarrays', 'esnext.asynciterable', 'esnext.symbol', 'esnext.bigint', 'esnext.weakref', 'esnext.object', 'esnext.regexp', 'esnext.string', 'esnext.float16', 'esnext.array', 'esnext.collection', 'esnext.error', 'esnext.iterator', 'esnext.typedarrays', 'esnext.promise', 'esnext.date', 'esnext.decorators', 'esnext.disposable', 'esnext.intl', 'esnext.sharedmemory', 'esnext.temporal', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'es2025', 'es2026', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.arraybuffer', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'es2023.intl', 'es2024.arraybuffer', 'es2024.collection', 'es2024.object', 'es2024.promise', 'es2024.regexp', 'es2024.sharedmemory', 'es2024.string', 'es2025.collection', 'es2025.float16', 'es2025.intl', 'es2025.iterator', 'es2025.promise', 'es2025.regexp', 'es2026.array', 'es2026.collection', 'es2026.error', 'es2026.iterator', 'es2026.json', 'es2026.math', 'es2026.typedarrays', 'esnext.asynciterable', 'esnext.symbol', 'esnext.bigint', 'esnext.weakref', 'esnext.object', 'esnext.regexp', 'esnext.string', 'esnext.float16', 'esnext.array', 'esnext.collection', 'esnext.error', 'esnext.iterator', 'esnext.typedarrays', 'esnext.promise', 'esnext.date', 'esnext.decorators', 'esnext.disposable', 'esnext.intl', 'esnext.modulesource', 'esnext.sharedmemory', 'esnext.temporal', 'decorators', 'decorators.legacy'. diff --git a/tsc/testdata/baselines/reference/tscWatch/commandLineWatch/watch-handles-tsconfig-deleted.js b/tsc/testdata/baselines/reference/tscWatch/commandLineWatch/watch-handles-tsconfig-deleted.js index 06b1d84ceeb08..4a72c167b4d4f 100644 --- a/tsc/testdata/baselines/reference/tscWatch/commandLineWatch/watch-handles-tsconfig-deleted.js +++ b/tsc/testdata/baselines/reference/tscWatch/commandLineWatch/watch-handles-tsconfig-deleted.js @@ -171,7 +171,7 @@ Diff:: incremental reports config read error while clean build without tsconfig - ---lib -Specify a set of bundled library declaration files that describe the target runtime environment. --one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy +-one or more: es5, es6/es2015, es7/es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, es2024, es2025, es2026, esnext, dom, dom.iterable, dom.asynciterable, webworker, webworker.importscripts, webworker.iterable, webworker.asynciterable, scripthost, es2015.core, es2015.collection, es2015.generator, es2015.iterable, es2015.promise, es2015.proxy, es2015.reflect, es2015.symbol, es2015.symbol.wellknown, es2016.array.include, es2016.intl, es2017.arraybuffer, es2017.date, es2017.object, es2017.sharedmemory, es2017.string, es2017.intl, es2017.typedarrays, es2018.asyncgenerator, es2018.asynciterable/esnext.asynciterable, es2018.intl, es2018.promise, es2018.regexp, es2019.array, es2019.object, es2019.string, es2019.symbol/esnext.symbol, es2019.intl, es2020.bigint/esnext.bigint, es2020.date, es2020.promise, es2020.sharedmemory, es2020.string, es2020.symbol.wellknown, es2020.intl, es2020.number, es2021.promise, es2021.string, es2021.weakref/esnext.weakref, es2021.intl, es2022.array, es2022.error, es2022.intl, es2022.object, es2022.string, es2022.regexp, es2023.array, es2023.collection, es2023.intl, es2024.arraybuffer, es2024.collection, es2024.object/esnext.object, es2024.promise, es2024.regexp/esnext.regexp, es2024.sharedmemory, es2024.string/esnext.string, es2025.collection, es2025.float16/esnext.float16, es2025.intl, es2025.iterator, es2025.promise, es2025.regexp, es2026.array/esnext.array, es2026.collection/esnext.collection, es2026.error/esnext.error, es2026.iterator/esnext.iterator, es2026.json, es2026.math, es2026.typedarrays/esnext.typedarrays, esnext.promise, esnext.date, esnext.decorators, esnext.disposable, esnext.intl, esnext.modulesource, esnext.sharedmemory, esnext.temporal, decorators, decorators.legacy -default: undefined - ---allowJs diff --git a/tsc/testdata/baselines/reference/tsoptions/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js b/tsc/testdata/baselines/reference/tsoptions/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js index 134b9070067c0..a72469815c053 100644 --- a/tsc/testdata/baselines/reference/tsoptions/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js +++ b/tsc/testdata/baselines/reference/tsoptions/commandLineParsing/parseCommandLine/Parse invalid option of library flags.js @@ -8,4 +8,4 @@ FileNames:: 0.ts Errors:: -error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'es2025', 'es2026', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.arraybuffer', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'es2023.intl', 'es2024.arraybuffer', 'es2024.collection', 'es2024.object', 'es2024.promise', 'es2024.regexp', 'es2024.sharedmemory', 'es2024.string', 'es2025.collection', 'es2025.float16', 'es2025.intl', 'es2025.iterator', 'es2025.promise', 'es2025.regexp', 'es2026.array', 'es2026.collection', 'es2026.error', 'es2026.iterator', 'es2026.json', 'es2026.math', 'es2026.typedarrays', 'esnext.asynciterable', 'esnext.symbol', 'esnext.bigint', 'esnext.weakref', 'esnext.object', 'esnext.regexp', 'esnext.string', 'esnext.float16', 'esnext.array', 'esnext.collection', 'esnext.error', 'esnext.iterator', 'esnext.typedarrays', 'esnext.promise', 'esnext.date', 'esnext.decorators', 'esnext.disposable', 'esnext.intl', 'esnext.sharedmemory', 'esnext.temporal', 'decorators', 'decorators.legacy'. +error TS6046: Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023', 'es2024', 'es2025', 'es2026', 'esnext', 'dom', 'dom.iterable', 'dom.asynciterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'webworker.asynciterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2016.intl', 'es2017.arraybuffer', 'es2017.date', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2019.intl', 'es2020.bigint', 'es2020.date', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2020.number', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.intl', 'es2022.object', 'es2022.string', 'es2022.regexp', 'es2023.array', 'es2023.collection', 'es2023.intl', 'es2024.arraybuffer', 'es2024.collection', 'es2024.object', 'es2024.promise', 'es2024.regexp', 'es2024.sharedmemory', 'es2024.string', 'es2025.collection', 'es2025.float16', 'es2025.intl', 'es2025.iterator', 'es2025.promise', 'es2025.regexp', 'es2026.array', 'es2026.collection', 'es2026.error', 'es2026.iterator', 'es2026.json', 'es2026.math', 'es2026.typedarrays', 'esnext.asynciterable', 'esnext.symbol', 'esnext.bigint', 'esnext.weakref', 'esnext.object', 'esnext.regexp', 'esnext.string', 'esnext.float16', 'esnext.array', 'esnext.collection', 'esnext.error', 'esnext.iterator', 'esnext.typedarrays', 'esnext.promise', 'esnext.date', 'esnext.decorators', 'esnext.disposable', 'esnext.intl', 'esnext.modulesource', 'esnext.sharedmemory', 'esnext.temporal', 'decorators', 'decorators.legacy'. diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource1.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource1.ts new file mode 100644 index 0000000000000..c9776c0af3e13 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource1.ts @@ -0,0 +1,11 @@ +// @module: esnext, preserve +// @target: esnext +// @lib: esnext + +// @filename: b.ts +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; + +// @filename: c.ts +import source a from "./a.wasm" with { type: "webassembly" }; +const b: AbstractModuleSource = a; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource10.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource10.ts new file mode 100644 index 0000000000000..4ff54c7f9fa0b --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource10.ts @@ -0,0 +1,11 @@ +// @module: preserve +// @target: esnext +// @rewriteRelativeImportExtensions: true + +// @filename: a.ts +export {}; + +// @filename: b.ts +import source a from "./a.ts"; +export { a }; +export const b = import.source("./a.ts"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource11.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource11.ts new file mode 100644 index 0000000000000..0b90c67612d87 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource11.ts @@ -0,0 +1,58 @@ +// @module: esnext +// @target: esnext +// @allowJs: true +// @noEmit: true + +// @filename: a.js +export default 1; +export const a = 2; + +// @filename: b.js +import source * as a from "./a.js"; + +// @filename: c.js +import source { a } from "./a.js"; + +// @filename: d.js +import source a, { a as b } from "./a.js"; + +// @filename: e.js +import source "./a.js"; + +// @filename: f.js +import.source; +(import.source)("./a.js"); +Function(import.source); +import.source.unknown; + +import.source(); +import.source("./a.js", {}, {}); +import.source?.("./a.js"); +import.source("./a.js"); +import.source(...["./a.js"]); + +// @filename: g.js +new import.source("./a.js"); + +// @filename: h.js +typeof import.source; + +// @filename: i.js +import.a("./a.js"); + +// @filename: j.js +import source a from "./a.js" with { type: "javascript" }; +const b = import.source("./a.js", { with: { type: "javascript" } }); +a; +b; + +// @filename: k.js +const a = import.source("./a.js", { with: { type: "javascript" } }); +a; + +// @filename: l.js +import s\u006furce from "./a.js"; +source; + +// @filename: m.js +import.s\u006furce("./a.js"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource12.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource12.ts new file mode 100644 index 0000000000000..ad61cd9fe45e0 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource12.ts @@ -0,0 +1,18 @@ +// @module: esnext +// @target: esnext +// @lib: esnext +// @allowJs: true +// @checkJs: true +// @noEmit: true +// @strict: true +// @noImplicitReferences: true + +// @filename: b.js +import source a from "./a.wasm"; +const b = import.source("./a.wasm"); + +/** @type {AbstractModuleSource} */ +const c = a; + +/** @type {Promise} */ +const d = b; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource13.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource13.ts new file mode 100644 index 0000000000000..cd2db1fdc8ea9 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource13.ts @@ -0,0 +1,13 @@ +// @module: nodenext +// @target: esnext +// @lib: esnext + +// @filename: b.mts +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; +const c: Promise = import.source("./a.wasm"); + +// @filename: c.cts +import source a from "./a.wasm"; +const b: AbstractModuleSource = a; +const c: Promise = import.source("./a.wasm"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource14.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource14.ts new file mode 100644 index 0000000000000..99924811258be --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource14.ts @@ -0,0 +1,12 @@ +// @module: nodenext +// @target: esnext +// @rewriteRelativeImportExtensions: true + +// @filename: package.json +{"type":"commonjs"} + +// @filename: a.ts +export {}; + +// @filename: b.cts +export const a = import.source("./a.ts"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource15.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource15.ts new file mode 100644 index 0000000000000..35fd883c0c777 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource15.ts @@ -0,0 +1,14 @@ +// @module: commonjs, nodenext +// @target: esnext +// @allowJs: true +// @noEmit: true + +// @filename: package.json +{"type":"commonjs"} + +// @filename: a.js +export default 1; + +// @filename: b.js +import source a from "./a.js"; +const b = import.source("./a.js"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource16.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource16.ts new file mode 100644 index 0000000000000..678bdee5d0f13 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource16.ts @@ -0,0 +1,21 @@ +// @module: esnext, nodenext, preserve +// @target: esnext +// @strict: true +// @noUncheckedSideEffectImports: false, true +// @declaration: true + +// @filename: index.mts +import source a from "./missing.wasm"; +import source b from "missing"; +import source c from "./a.txt"; +import source d from "./a.js"; +import source e from "./a.d.ts"; +import source f from "./a.ts"; +export { a, b, c, d, e, f }; +const sources: AbstractModuleSource[] = [a, b, c, d, e, f]; +export const g = import.source("./missing.wasm"); +export const h = import.source("missing"); +export const i = import.source("./a.txt"); +export function load(path: string): Promise { + return import.source(path); +} diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource17.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource17.ts new file mode 100644 index 0000000000000..027f43ade0539 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource17.ts @@ -0,0 +1,18 @@ +// @module: esnext +// @target: esnext +// @strict: true + +// @filename: index.ts +import source a from "./a.wasm"; +const b: string = a; +a.exports; +a.value; +import(a); +import.source(a); +import.source(1); +import.source(undefined); +import.source("./a.wasm", 1); +import.source("./a.wasm", { with: { type: 1 } }); +import.source("./a.wasm", { assert: { type: "webassembly" } }); +new AbstractModuleSource(); +type C = AbstractModuleSource; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource18.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource18.ts new file mode 100644 index 0000000000000..92b3b264029cc --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource18.ts @@ -0,0 +1,8 @@ +// @module: esnext +// @target: esnext +// @lib: es2020 + +// @filename: index.ts +import source a from "./a.wasm"; +a; +import.source("./a.wasm"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource19.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource19.ts new file mode 100644 index 0000000000000..f2e1bd7b76016 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource19.ts @@ -0,0 +1,21 @@ +// @module: esnext +// @target: esnext +// @strict: true +// @declaration: true + +// @filename: globals.d.ts +declare module "*.wasm" { + const value: string; + export default value; +} +declare namespace WebAssembly { + interface Module { value: number; } +} + +// @filename: index.ts +import a from "./a.wasm"; +import source b from "./a.wasm"; +const c: string = a; +const d: AbstractModuleSource = b; +export { b }; +export const e = import.source("./a.wasm"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource2.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource2.ts new file mode 100644 index 0000000000000..2a3b9325f2b14 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource2.ts @@ -0,0 +1,25 @@ +// @module: esnext, preserve +// @target: esnext +// @lib: esnext + +// @filename: b.ts +export {}; +const a = import.source("./a.wasm"); +const b: Promise = a; + +// @filename: c.ts +export {}; +const a = import.source("./a.wasm", { with: { type: "webassembly" } }); +const b: Promise = a; + +// @filename: d.ts +export {}; +const a = import.source("./a.wasm",); +const b: Promise = a; +const c = import.source("./a.wasm", { with: { type: "webassembly" } },); +const d: Promise = c; + +// @filename: e.ts +export {}; +const a = import.source(`./a.wasm`); +const b: Promise = a; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource20.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource20.ts new file mode 100644 index 0000000000000..c7b621672547e --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource20.ts @@ -0,0 +1,20 @@ +// @module: nodenext, preserve +// @target: esnext +// @strict: true +// @declaration: true +// @noImplicitReferences: true + +// @filename: node_modules/pkg/package.json +{ "type": "module", "exports": { "types": "./index.d.ts", "default": "./missing.wasm" } } + +// @filename: node_modules/pkg/index.d.ts +export const value: number; + +// @filename: index.mts +import source a from "pkg"; +import { value } from "pkg"; +const b: AbstractModuleSource = a; +const c: number = value; +export const d = import.source("pkg"); +export const e = import("pkg"); +export { a }; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource21.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource21.ts new file mode 100644 index 0000000000000..0c72a7518b79a --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource21.ts @@ -0,0 +1,11 @@ +// @module: esnext +// @target: esnext +// @verbatimModuleSyntax: false, true +// @declaration: true + +// @filename: index.ts +import source a from "./a.wasm"; +import source b from "./b.wasm"; +import source c from "./c.wasm"; +export type A = typeof a; +export const d = c; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource3.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource3.ts new file mode 100644 index 0000000000000..c1e60b3298943 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource3.ts @@ -0,0 +1,42 @@ +// @module: preserve +// @target: esnext +// @lib: esnext + +// @filename: a.ts +export default 1; +export const a = 2; + +// @filename: b.ts +import source from "./a.js"; +const a: number = source; + +// @filename: c.ts +import source, { a } from "./a.js"; +const b: number = source + a; + +// @filename: d.ts +import source = require("./a"); +const a: typeof source = source; + +// @filename: e.ts +const source = 1; +const a: number = source; + +// @filename: g.ts +import source from from "./f.wasm"; +const a: AbstractModuleSource = from; + +// @filename: h.ts +import source type from "./f.wasm"; +const a: AbstractModuleSource = type; + +// @filename: i.ts +import source source from "./f.wasm"; +const a: AbstractModuleSource = source; + +// @filename: j.ts +import +source +a +from "./f.wasm"; +const b: AbstractModuleSource = a; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource4.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource4.ts new file mode 100644 index 0000000000000..48b49899a91c4 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource4.ts @@ -0,0 +1,21 @@ +// @module: esnext +// @target: esnext + +// @filename: a.ts +export default 1; +export const a = 2; + +// @filename: b.ts +import source * as a from "./a.js"; + +// @filename: c.ts +import source { a } from "./a.js"; + +// @filename: d.ts +import source a, { a as b } from "./a.js"; + +// @filename: e.ts +import source "./a.js"; + +// @filename: f.ts +import source type a from "./a.js"; diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource5.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource5.ts new file mode 100644 index 0000000000000..86cb9d583cde5 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource5.ts @@ -0,0 +1,29 @@ +// @module: esnext +// @target: esnext + +// @filename: a.ts +export default 1; + +// @filename: b.ts +import.source; +(import.source)("./a.js"); +Function(import.source); +import.source.unknown; + +import.source(); +import.source("./a.js", {}, {}); +import.source?.("./a.js"); +import.source("./a.js"); +import.source(...["./a.js"]); + +// @filename: c.ts +new import.source("./a.js"); + +// @filename: d.ts +new import.source("./a.js").a; + +// @filename: e.ts +typeof import.source; + +// @filename: f.ts +import.a("./a.js"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource6.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource6.ts new file mode 100644 index 0000000000000..0d7d11a9d6c56 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource6.ts @@ -0,0 +1,9 @@ +// @module: commonjs +// @target: esnext + +// @filename: a.ts +export default 1; + +// @filename: b.ts +import source a from "./a.js"; +const b = import.source("./a.js"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource7.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource7.ts new file mode 100644 index 0000000000000..c0eeedd19c9a7 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource7.ts @@ -0,0 +1,15 @@ +// @module: esnext +// @target: esnext +// @allowArbitraryExtensions: true +// @lib: esnext + +// @filename: a.d.wasm.ts +export const a: number; + +// @filename: b.ts +import { a } from "./a.wasm"; +import source b from "./a.wasm"; + +const c: number = a; +const d: AbstractModuleSource = b; +const e: Promise = import.source("./a.wasm"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource8.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource8.ts new file mode 100644 index 0000000000000..9278d6f0ee466 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource8.ts @@ -0,0 +1,8 @@ +// @module: esnext +// @target: esnext +// @lib: esnext + +// @filename: b.ts +/*comment a*/ import /*comment b*/ source /*comment c*/ a /*comment d*/ from /*comment e*/ "./a.wasm" /*comment f*/ with /*comment g*/ { type: "webassembly" } /*comment h*/; +const b = a; +const c = import /*comment i*/ . /*comment j*/ source /*comment k*/ ("./a.wasm"); diff --git a/tsc/testdata/tests/cases/conformance/importSource/importSource9.ts b/tsc/testdata/tests/cases/conformance/importSource/importSource9.ts new file mode 100644 index 0000000000000..c1a1c493cc595 --- /dev/null +++ b/tsc/testdata/tests/cases/conformance/importSource/importSource9.ts @@ -0,0 +1,21 @@ +// @module: esnext +// @target: esnext +// @declaration: true +// @lib: esnext + +// @filename: b.ts +import source a from "./a.wasm"; +export { a }; + +// @filename: c.ts +import { a } from "./b.js"; +const b: AbstractModuleSource = a; + +// @filename: d.ts +import * as a from "./b.js"; +const b: AbstractModuleSource = a.a; + +// @filename: e.ts +import source a from "./a.wasm"; +export type B = typeof a; +export const b = import.source("./a.wasm");