* Use fixed time for vfs so baselining is consistent * Baseline buildinfos * Write new file text in baseline even if the file wasnt read on the shadow * Remove unnecessary debugger statement * Make sure that incremental correctness is checked with correct writeFile so we know buildInfo was written Also baseline these so its easy to verify the changes * More baselines for the tsbuildinfo * If we are writing dts file and have used file text as version, we can update the signature when doing actual emit * Make WriteFileCallback Api ready for future * Assert that there is only single source file when emitting d.ts file * Add test * Renames * More refactoring * If we are updating dts of any of the file and it affects global scope, everything needs update in signature and dts emit Fixes #42769 * Stacktrace optimization for getModified time in anticipation of using it more than fileExists wherever possible * Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment * Remove unnecessary write file finger print code since its not used at all * Use modified time instead of file existence check * Remove unnecessary getModifiedTime * No need to check for file existence before reading the d.ts file * Do project reference errors before doing input/output file checks * Dont call getModifiedTimes if dts change * Passdown modified time if queried * Use modified time passed through the file watching in tsbuild * Handle force build as separate upto date status * uptodate status worker to read buildinfo and use it to determine upto date ness * No need to update output timestamps if buildinfo will determine uptodateness * Store change file set instead of hasPendingChange to be able to reuse the information * Add test that shows input file is not present * No need to check input time stamp before buildinfo * Keep buildinfos for lifetime of the solution builder and project * Store modified time along with text of buildinfo * Non composite projects dont need to track declaration change time * Pass through buildInfo so we dont have to parse it back * Save dts change time in buildinfo itself * Store dts time for --out in the buildInfo * Store hash of text in the bundle info so it can be verified before manipulating text for fast updates during prepend This helps when text changes during incremental build toggling and we determine we can just manipulate text * Since buildinfo is cached no need to maintain version check state * Store output time stamps for non incremental builds * Revert "Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment" This reverts commit 7e65cd3315ccf387f6d7e7c40263e85bcc3c961c. * Change verbose messages for upto date status * Reconcile reusable builder state and builder state so there are not two different types that are almost similar looking * Cleanup impliedFormat * Cleanup * Cleanup noEmit option * BuildInfo options emit as a flag * Factor out types for program written in buildinfo with and without bundle emit * No need to store output file stamps if not in watch mode * Cleanup * Test for single watch per file * Fix emit and error update baselines that were duplicate * More refactoring * Only copy emit state fields when backing up to restore if emit fails * Instead of maintaining delta of changes, maintain old state for those changes * Add test to verify build when input file does not change * If version of the input file does not change, dont mark as out of date * Disable lint warning as build fails without the assert * Report aggregate statistics for solution as well as some solution perf numbers * Options solutionDiagnostics instead so that its not too verbose when printing diagnostics * When tsc --build --clean, only remove tsbuildinfo if its incremental build * Revert "Options solutionDiagnostics instead so that its not too verbose when printing diagnostics" This reverts commit 0cf9e301038267bc1d9439c15d279940809b0c00. * Revert "Report aggregate statistics for solution as well as some solution perf numbers" This reverts commit 405d8e91978708a613fe8cb631a83b13c430a808. * Revert "When tsc --build --clean, only remove tsbuildinfo if its incremental build" This reverts commit e4e66726098201f38f5e8908a538e7a506f15efd. * Comments in the code * Feedback
TypeScript
TypeScript is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the playground, and stay up to date via our blog and Twitter account.
Find others who are using TypeScript at our community page.
Installing
For the latest stable version:
npm install -g typescript
For our nightly builds:
npm install -g typescript@next
Contribute
There are many ways to contribute to TypeScript.
- Submit bugs and help us verify fixes as they are checked in.
- Review the source code changes.
- Engage with other TypeScript users and developers on StackOverflow.
- Help each other in the TypeScript Community Discord.
- Join the #typescript discussion on Twitter.
- Contribute bug fixes.
- Read the archived language specification (docx, pdf, md).
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Documentation
Building
In order to build the TypeScript compiler, ensure that you have Git and Node.js installed.
Clone a copy of the repo:
git clone https://github.com/microsoft/TypeScript.git
Change to the TypeScript directory:
cd TypeScript
Install Gulp tools and dev dependencies:
npm install -g gulp
npm ci
Use one of the following to build and test:
gulp local # Build the compiler into built/local.
gulp clean # Delete the built compiler.
gulp LKG # Replace the last known good with the built one.
# Bootstrapping step to be executed when the built compiler reaches a stable state.
gulp tests # Build the test infrastructure using the built compiler.
gulp runtests # Run tests using the built compiler and test infrastructure.
# You can override the specific suite runner used or specify a test for this command.
# Use --tests=<testPath> for a specific test and/or --runner=<runnerName> for a specific suite.
# Valid runners include conformance, compiler, fourslash, project, user, and docker
# The user and docker runners are extended test suite runners - the user runner
# works on disk in the tests/cases/user directory, while the docker runner works in containers.
# You'll need to have the docker executable in your system path for the docker runner to work.
gulp runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system
# core count by default. Use --workers=<number> to adjust this.
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
gulp lint # Runs eslint on the TypeScript source.
gulp help # List the above commands.
Usage
node built/local/tsc.js hello.ts
Roadmap
For details on our planned features and future direction please refer to our roadmap.