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
No linting error on wrong array types
Name Value ---- ----- PSVersion 7.3.9 PSEdition Core GitCommitId 7.3.9 OS Microsoft Windows 10.0.22635 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
1.83.1 f1b07bd25dfad64b0167beb15359ae573aecd2cc x64
[email protected]
[string[]]$stringArray = @( 1 2 ) $stringArray += 2
The text was updated successfully, but these errors were encountered:
Thanks @Malix-off this is actually correct as to how PowerShell works...if you want a custom rule about this check out PSScriptAnalyzer
Sorry, something went wrong.
@SydneyhSmith:
Can you explain? 2 is converted from an int type to a string type in the process?
This issue has been marked as resolved and has not had any activity for 1 day. It has been closed for housekeeping purposes.
@Malix-off that is correct, try it out in PowerShell:
@andyjordane318 ~ > [string[]]$myArray = @(1, 2) @andyjordane318 ~ > $myArray | %{ $_.GetType() } IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True String System.Object True True String System.Object @andyjordane318 ~
No branches or pull requests
Prerequisites
Summary
No linting error on wrong array types
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
Visuals
The text was updated successfully, but these errors were encountered: