| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Please read the FAQ before logging new issues, even if you think you have found a bug.
Issues that ask questions answered in the FAQ will be closed without elaboration.
Search the existing issues before logging a new one.
Some search tips:
The issue tracker is for issues, in other words, bugs and suggestions. If you have a question, please use Stack Overflow, Gitter, your favorite search engine, or other resources. Due to increased traffic, we can no longer answer questions in the issue tracker.
When logging a bug, please be sure to include the following:
You can try out the nightly build of TypeScript (npm install typescript@next) to see if the bug has already been fixed.
We also accept suggestions in the issue tracker. Be sure to check the FAQ and search first.
In general, things we find useful when reviewing suggestions are:
Running hereby --tasks provides the full listing, but here are a few common tasks you might use.
hereby local # Build the compiler into built/local.
hereby clean # Delete the built compiler.
hereby LKG # Replace the last known good with the built one.
# Bootstrapping step to be executed when the built compiler reaches a stable state.
hereby tests # Build the test infrastructure using the built compiler.
hereby 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, and project
hereby 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.
hereby baseline-accept # This replaces the baseline test results with the results obtained from hereby runtests.
hereby lint # Runs eslint on the TypeScript source.
hereby help # List the above commands.
If you prefer to develop using containers, this repository includes a development container that you can use to quickly create an isolated development environment with all the tools you need to start working on TypeScript. To get started with a dev container and VS Code, either:
The TypeScript repository is relatively large. To save some time, you might want to clone it without the repo's full history using git clone --depth=1.
You might need to run git config --global core.longpaths true before cloning TypeScript on Windows.
Run hereby to build a version of the compiler/language service that reflects changes you've made. You can then run node <repo-root>/built/local/tsc.js in place of tsc in your project. For example, to run tsc --watch from within the root of the repository on a file called test.ts, you can run node ./built/local/tsc.js --watch test.ts.
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved (labelled "help wanted" or in the "Backlog milestone") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (labelled "help wanted" or in the "Backlog" milestone) by a TypeScript project maintainer in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
If you intend to work on an issue, please avoid leaving comments like "I'm going to work on this". There are a few reasons for this. These comments tend to discourage anyone from working in the area, yet many issues are much more difficult than they first appear, and you might find yourself trying to fix several issues before finding one that can be completed. Many issues have a long trail of people indicating that they're going to try to fix it, but no PR.
Conversely, you do not need to ask anyone's permission before starting work on an issue marked as "help wanted". It's always fine to try! We ask that you choose issues tagged in the "Backlog" milestone as these are issues that we've identified as needing fixes / implementations.
The sheer quantity of open issues, combined with their general difficulty, makes it extremely unlikely that you and another contributor are a) working on the same issue and b) both going to find a solution.
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright. Upon submitting a pull request, you will automatically be given instructions on how to sign the CLA.
Your pull request should:
Avoid force-pushing your changes, especially when updating your PR based on review feedback. Force-pushed changes are not easily viewable on GitHub, and not at all viewable if a force-push also rebases against main. TypeScript PRs are squash merged, so the specific commits on your PR branch do not matter, only the PR title itself. Don't worry about having a perfect commit history; instead focus on making your changes as easy to review and merge as possible.
There are three relevant locations to be aware of when it comes to TypeScript's library declaration files:
Any changes should be made to src/lib. Most of these files can be updated by hand, with the exception of any generated files (see below).
Library files in built/local/ are updated automatically by running the standard build task:
herebyThe files in lib/ are used to bootstrap compilation and usually should not be updated unless publishing a new version or updating the LKG.
The files src/lib/dom.generated.d.ts and src/lib/webworker.generated.d.ts both represent type declarations for the DOM and are auto-generated. To make any modifications to them, you will have to direct changes to https://github.com/Microsoft/TSJS-lib-generator
If you need a head start understanding how the compiler works, or how the code in different parts of the compiler works, there is a separate repo: TypeScript Compiler Notes. As the name implies, it contains notes understood by different engineers about different parts of the compiler.
To run all tests, invoke the runtests-parallel target using hereby:
hereby runtests-parallelThis will run all tests; to run only a specific subset of tests, use:
hereby runtests --tests=<regex>e.g. to run all compiler baseline tests:
hereby runtests --tests=compileror to run a specific test: tests\cases\compiler\2dArrays.ts
hereby runtests --tests=2dArraysYou can debug with VS Code or Node instead with hereby runtests -i:
hereby runtests --tests=2dArrays -iYou can also use the provided VS Code launch configuration to launch a debug session for an open test file. Rename the file 'launch.json', open the test file of interest, and launch the debugger from the debug panel (or press F5).
To add a new test case, add a .ts file in tests\cases\compiler with code that shows the bug is now fixed, or your new feature now works.
These files support metadata tags in the format // @metaDataName: value. The supported names and values are the same as those supported in the compiler itself, with the addition of the fileName flag. fileName tags delimit sections of a file to be used as separate compilation units. They are useful for testing modules. See below for examples.
Note that if you have a test corresponding to a specific area of spec compliance, you can put it in the appropriate subfolder of tests\cases\conformance. Note that test filenames must be distinct from all other test names, so you may have to work a bit to find a unique name if it's something common.
When you need to mimic having multiple files in a single test to test features such as "import", use the filename tag:
// @filename: file1.ts
export function f() {
}
// @filename: file2.ts
import { f as g } from "file1";
var x = g();Most tests generate "baselines" to find differences in output. As an example, compiler tests usually emit one file each for
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
git diff --diff-filter=AM --no-index ./tests/baselines/reference ./tests/baselines/localAlternatively, you can set the DIFF environment variable and run hereby diff, or manually run your favorite folder diffing tool between tests/baselines/reference and tests/baselines/local. Our team largely uses Beyond Compare and WinMerge.
After verifying that the changes in the baselines are correct, run
hereby baseline-acceptThis will change the files in tests\baselines\reference, which should be included as part of your commit. Be sure to validate the changes carefully -- apparently unrelated changes to baselines can be clues about something you didn't think of.
All strings the user may see are stored in diagnosticMessages.json. If you make changes to it, run hereby generate-diagnostics to push them to the Diagnostic interface in diagnosticInformationMap.generated.ts.
| Back | FazBrowse Home | New Git URL |