We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"ts2322" "tuples" "null type guard"
Typescript version 5.5.4
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240828#code/C4TwDgpgBAIghsCAlOA7A5hAKuaBeKAbXkSgB8pUBXAGxoBpYFoLq6BdAKE4GMB7VAGdgUAE5pMALiaIUGbLigFCqCAHcZEABQBKRqo0ltO9gG5u-ISMTClUXUoB8UAN6coHqAEsAZvfHyhAAM7Ep4BGw05BQBmIQAjKHhEbQ0Oq7unlmiEMBUoqjmWQC+mR6WtgBG0sTMjEZJYhIQplAA9G1QWADKUABMAMx9fZzFQA
type DateRangeType = [Date | null, Date | null] const range: DateRangeType = [new Date(), new Date()]; const test = () => { if (range[0] === null || range[1] === null) { return; } const b: [Date, Date] = range; // TS 2322 }
Error on line const b: [Date, Date] = range; // TS 2322
const b: [Date, Date] = range; // TS 2322
Type of range would be narrowed down to [Date, Date]
[Date, Date]
No response
The text was updated successfully, but these errors were encountered:
Duplicate of #42384
Sorry, something went wrong.
No branches or pull requests
π Search Terms
"ts2322" "tuples" "null type guard"
π Version & Regression Information
Typescript version 5.5.4
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.7.0-dev.20240828#code/C4TwDgpgBAIghsCAlOA7A5hAKuaBeKAbXkSgB8pUBXAGxoBpYFoLq6BdAKE4GMB7VAGdgUAE5pMALiaIUGbLigFCqCAHcZEABQBKRqo0ltO9gG5u-ISMTClUXUoB8UAN6coHqAEsAZvfHyhAAM7Ep4BGw05BQBmIQAjKHhEbQ0Oq7unlmiEMBUoqjmWQC+mR6WtgBG0sTMjEZJYhIQplAA9G1QWADKUABMAMx9fZzFQA
π» Code
π Actual behavior
Error on line
const b: [Date, Date] = range; // TS 2322
π Expected behavior
Type of range would be narrowed down to
[Date, Date]
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: