Skip to content

Commit a6c56ef

Browse files
committed
feat(lib): define TypedArray interface
Each concrete typed array type and constructor share common interfaces. Library types can be defined extending base interfaces: 1. higher code reuse 2. less duplication 3. easier maintenance (less error prone) Closes #15402 Fixes #45198
0 parents  commit a6c56ef

File tree

71,974 files changed

+8574328
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71,974 files changed

+8574328
-0
lines changed

.c8rc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"reporter": ["lcovonly", "cobertura"],
3+
"src": "src",
4+
"include": ["src/**", "built/local/**"],
5+
"exclude": ["**/node_modules/**"],
6+
"mergeAsync": true
7+
}

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.245.2/containers/javascript-node/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Node.js version: 18, 16, 14
4+
ARG VARIANT="18-buster"
5+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
6+
7+
RUN sudo -u node npm install -g hereby

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "Node.js",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {
6+
"VARIANT": "18"
7+
}
8+
},
9+
"customizations": {
10+
"vscode": {
11+
"settings": {
12+
"terminal.integrated.defaultProfile.linux": "bash",
13+
"terminal.integrated.profiles.linux": {
14+
"bash": {
15+
"path": "/bin/bash",
16+
"icon": "terminal-bash"
17+
}
18+
}
19+
},
20+
"extensions": [
21+
"dbaeumer.vscode-eslint",
22+
"dprint.dprint"
23+
]
24+
}
25+
},
26+
"remoteUser": "node"
27+
}

.dprint.jsonc

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
// If updating this, also update the config in dtsBundler.mjs.
3+
"indentWidth": 4,
4+
"lineWidth": 1000,
5+
"newLineKind": "auto",
6+
"useTabs": false,
7+
"typescript": {
8+
"newLineKind": "crlf",
9+
"semiColons": "always",
10+
"quoteStyle": "preferDouble",
11+
"quoteProps": "consistent",
12+
"useBraces": "whenNotSingleLine",
13+
"bracePosition": "sameLineUnlessHanging",
14+
"singleBodyPosition": "sameLine",
15+
"nextControlFlowPosition": "nextLine", // Stroustrup style braces.
16+
"trailingCommas": "onlyMultiLine",
17+
"preferHanging": false,
18+
"operatorPosition": "maintain",
19+
20+
"arrowFunction.useParentheses": "preferNone",
21+
"conditionalExpression.linePerExpression": false, // Keep our "match/case"-ish conditionals.
22+
"functionExpression.spaceAfterFunctionKeyword": true,
23+
"importDeclaration.forceMultiLine": "whenMultiple",
24+
"constructorType.spaceAfterNewKeyword": true,
25+
"constructSignature.spaceAfterNewKeyword": true,
26+
27+
"module.sortImportDeclarations": "caseInsensitive",
28+
"module.sortExportDeclarations": "caseInsensitive",
29+
"exportDeclaration.sortNamedExports": "caseInsensitive",
30+
"importDeclaration.sortNamedImports": "caseInsensitive"
31+
},
32+
"prettier": {
33+
"newLineKind": "lf",
34+
"associations": [
35+
"**/*.{yaml,yml}"
36+
],
37+
"yml.tabWidth": 2,
38+
"yaml.tabWidth": 2,
39+
"yml.singleQuote": true,
40+
"yaml.singleQuote": true
41+
},
42+
"json": {
43+
// This would be good to do in known-JSONC files, but VS Code warns on trailing commas.
44+
"trailingCommas": "never"
45+
},
46+
"excludes": [
47+
"**/.git",
48+
"**/node_modules",
49+
"**/*-lock.json",
50+
"coverage/**",
51+
"lib/**",
52+
"built/**",
53+
"tests/**",
54+
"internal/**",
55+
"**/*.generated.*",
56+
"scripts/*.d.*",
57+
"**/_namespaces/**"
58+
],
59+
// Note: if adding new languages, make sure settings.template.json is updated too.
60+
// Also, if updating typescript, update the one in package.json.
61+
"plugins": [
62+
"https://plugins.dprint.dev/typescript-0.91.1.wasm",
63+
"https://plugins.dprint.dev/json-0.19.3.wasm",
64+
"https://plugins.dprint.dev/prettier-0.40.0.json@68c668863ec834d4be0f6f5ccaab415df75336a992aceb7eeeb14fdf096a9e9c"
65+
]
66+
}

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
root = true
3+
4+
[{src,scripts}/**.{ts,json,js}]
5+
end_of_line = crlf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 4

.git-blame-ignore-revs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Generated module conversion step - inlineImports
2+
07758c08ab72481885e662c98d67a0e3a071b032
3+
# Generated module conversion step - stripNamespaces
4+
b6c053882696af8ddd94a600429f30584d303d7f
5+
# Generated module conversion step - explicitify
6+
9a0b85ce2a3f85f498ab2c05474b4c0b96b111c9
7+
# Generated module conversion step - unindent
8+
94724a8c2e68a4c7e267072ca79971f317c45e4a
9+
# dprint
10+
5e8c261b6ab746213f19ee3501eb8c48a6215dd7

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.js linguist-language=TypeScript
2+
**/*.json linguist-language=jsonc
3+
* -text

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: 'Bug report'
2+
description: 'Create a report to help us improve TypeScript'
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
🔍 Please [search thoroughly in GitHub](https://github.com/Microsoft/TypeScript/search?type=Issues) or by the query `site:github.com/microsoft/TypeScript <your keywords>` in your favorite search engine before reporting a new bug as most bugs are very likely to find precedents.
8+
9+
Please fill in each section completely. Thank you!
10+
- type: textarea
11+
id: search_terms
12+
attributes:
13+
label: '🔎 Search Terms'
14+
description: |
15+
What search terms did you use when trying to find an existing bug report?
16+
17+
List them here so people in the future can find this one more easily.
18+
placeholder: |
19+
List of keywords you searched for before creating this issue. Write them down here so that others can find this bug more easily and help provide feedback.
20+
21+
e.g. "function inference any", "jsx attribute spread", "move to file duplicate imports", "discriminated union inference", "ts2822"
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: version_info
26+
attributes:
27+
label: '🕗 Version & Regression Information'
28+
description: |
29+
When did you start seeing this bug occur?
30+
31+
"Bugs" that have existed in TS for a long time are very likely to be FAQs; please refer to the [FAQ wiki page](https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs).
32+
33+
Please try the nightly version of TS to see if it's already been fixed. Install `typescript@next` or use the [Playground](http://www.typescriptlang.org/play/?ts=Nightly).
34+
35+
If possible, try bisecting the issue using [every-ts](https://www.npmjs.com/package/every-ts#bisecting), which should narrow down the problem to a specific change.
36+
37+
The Playground also supports versions of TypeScript back to TypeScript 3.3.
38+
39+
Please keep and fill in the line that best applies.
40+
value: |
41+
- This is a crash
42+
- This changed between versions ______ and _______
43+
- This changed in commit or PR _______
44+
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
45+
- I was unable to test this on prior versions because _______
46+
validations:
47+
required: true
48+
- type: input
49+
id: playground_link
50+
attributes:
51+
label: ⏯ Playground Link
52+
description: |
53+
A link to a TypeScript Playground "Share" link which shows this behavior.
54+
55+
This should have the same code as the code snippet below, and use whichever settings are relevant to your report.
56+
57+
As a last resort, you can link to a repo, but these will be slower for us to investigate.
58+
placeholder: 'Playground link with relevant code: https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA'
59+
validations:
60+
required: false
61+
- type: textarea
62+
id: code
63+
attributes:
64+
label: 💻 Code
65+
description: |
66+
Please post the relevant code sample here as well.
67+
68+
This code and the Playground code should be the same, do not use separate examples.
69+
70+
We can quickly address your report if:
71+
72+
- The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!
73+
- It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.
74+
- The incorrectness of the behavior is readily apparent from reading the sample.
75+
76+
Reports are slower to investigate if:
77+
78+
- We have to pare too much extraneous code.
79+
- We have to clone a large repo and validate that the problem isn't elsewhere.
80+
- The sample is confusing or doesn't clearly demonstrate what's wrong.
81+
value: |
82+
```ts
83+
// Your code here
84+
```
85+
validations:
86+
required: false
87+
- type: textarea
88+
id: actual_behavior
89+
attributes:
90+
label: 🙁 Actual behavior
91+
description: 'What happened, and why it was wrong.'
92+
validations:
93+
required: true
94+
- type: textarea
95+
id: expected_behavior
96+
attributes:
97+
label: 🙂 Expected behavior
98+
description: What you expected to happen instead, and why
99+
validations:
100+
required: true
101+
- type: textarea
102+
id: additional_info
103+
attributes:
104+
label: Additional information about the issue

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
blank_issues_enabled: false
3+
contact_links:
4+
- about: 'Please ask and answer usage questions on Stack Overflow.'
5+
name: Question
6+
url: 'https://stackoverflow.com/questions/tagged/typescript'
7+
- about: 'Alternatively, you can use the TypeScript Community Discord.'
8+
name: Chat
9+
url: 'https://discord.gg/typescript'
10+
- about: 'Please check the FAQ before filing new issues'
11+
name: 'TypeScript FAQ'
12+
url: 'https://github.com/microsoft/TypeScript/wiki/FAQ'
13+
- about: 'Please raise issues about the site on its own repo.'
14+
name: Website
15+
url: 'https://github.com/microsoft/TypeScript-Website/issues/new'
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: 'Feature request'
2+
description: 'Suggest an idea'
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
💡 Did you know? TypeScript has over 2,000 open suggestions!
8+
9+
🔎 Please [search thoroughly in GitHub](https://github.com/Microsoft/TypeScript/search?type=Issues) or by the query `site:github.com/microsoft/TypeScript <your keywords>` in your favorite search engine before logging new feature requests as most common ideas already have a proposal in progress.
10+
11+
The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests
12+
13+
Please fill in each section completely. Thank you!
14+
- type: textarea
15+
id: search_terms
16+
attributes:
17+
label: '🔍 Search Terms'
18+
description: |
19+
What search terms did you use when trying to find an existing suggestion?
20+
21+
List them here so people in the future can find this one more easily.
22+
placeholder: |
23+
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
24+
25+
e.g. "isArray readonly", "regex string types", "json const assertion import"
26+
validations:
27+
required: true
28+
- type: checkboxes
29+
id: viability_checklist
30+
attributes:
31+
label: '✅ Viability Checklist'
32+
description: |
33+
Suggestions that don't meet all these criteria are very, very unlikely to be accepted. We always recommend reviewing the TypeScript design goals before investing time writing a proposal for ideas outside the scope of the project.
34+
35+
My suggestion meets the following guidelines.
36+
options:
37+
- label: This wouldn't be a breaking change in existing TypeScript/JavaScript code
38+
required: true
39+
- label: This wouldn't change the runtime behavior of existing JavaScript code
40+
required: true
41+
- label: This could be implemented without emitting different JS based on the types of the expressions
42+
required: true
43+
- label: This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
44+
required: true
45+
- label: "This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types"
46+
required: true
47+
- label: 'This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals'
48+
required: true
49+
- type: textarea
50+
id: suggestion_summary
51+
attributes:
52+
label: '⭐ Suggestion'
53+
description: "A summary of what you'd like to see added or changed"
54+
validations:
55+
required: true
56+
- type: textarea
57+
id: motivating_example
58+
attributes:
59+
label: '📃 Motivating Example'
60+
description: |
61+
If you were announcing this feature in a blog post, what's a short explanation that shows a developer why this feature improves the language?
62+
validations:
63+
required: true
64+
- type: textarea
65+
id: use_cases
66+
attributes:
67+
label: '💻 Use Cases'
68+
value: |
69+
1. What do you want to use this for?
70+
2. What shortcomings exist with current approaches?
71+
3. What workarounds are you using in the meantime?
72+
validations:
73+
required: true

.github/ISSUE_TEMPLATE/lib_change.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 'Library change'
2+
description: 'Fix or improve issues with built-in type definitions like `lib.es6.d.ts`, etc.'
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
### Please fill in each section completely. Thank you!
8+
9+
Are you here for one of these commonly-requested lib changes?
10+
11+
* Object.keys - see https://stackoverflow.com/questions/55012174/
12+
* Array methods - see https://github.com/microsoft/TypeScript/issues/36554
13+
* `parseInt`, `parseFloat`, `isFinite`, `isNaN`, etc. - see https://github.com/microsoft/TypeScript/issues/4002
14+
15+
The DOM lib is maintained elsewhere and you can skip a step by filing issues/PRs for the DOM at that repo. See https://github.com/microsoft/TypeScript-DOM-lib-generator
16+
- type: markdown
17+
attributes:
18+
value: |
19+
If you're missing common new methods like `Array.includes`, you may have a misconfigured project. Try setting `lib: "es2020"` and checking whether the type you want is present. You can diagnose further by running `tsc` with `--listFilesOnly` or `--showConfig`.
20+
21+
Conversely, if you are seeing built-in methods you expect to *not* see, check your 'lib' setting or review your dependencies for lib/reference directives that might be polluting your global scope. This is common when using the 'node' type library. See https://github.com/microsoft/TypeScript/issues/40184
22+
- type: input
23+
id: compilation_target
24+
attributes:
25+
label: '⚙ Compilation target'
26+
description: "What's your compilation target (e.g.: `ES2015`)?"
27+
validations:
28+
required: true
29+
- type: input
30+
id: current_lib
31+
attributes:
32+
label: '⚙ Library'
33+
description: "What's the current library you're using?"
34+
validations:
35+
required: true
36+
- type: textarea
37+
id: incorrect_definition
38+
attributes:
39+
label: 'Missing / Incorrect Definition'
40+
description: 'What property, method, function, etc. is missing or incorrect?'
41+
validations:
42+
required: true
43+
- type: textarea
44+
id: sample_code
45+
attributes:
46+
label: 'Sample Code'
47+
description: "What's some code using this that should work, but doesn't?"
48+
render: TypeScript
49+
validations:
50+
required: true
51+
- type: textarea
52+
id: documentation_link
53+
attributes:
54+
label: 'Documentation Link'
55+
description: |
56+
Link to relevant documentation (e.g. MDN, W3C, ECMAScript Spec) to consult for this property. Note that lib.dom.d.ts intentionally does not include browser-specific extensions or early experimental features.

0 commit comments

Comments
 (0)