-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking
Expected Behaviour
Getting only this warning
This variable is defined as type `string`. Cannot convert its type to `nil`.
- `nil` cannot match `string`
- `nil` cannot match any subtypes in `string`
Actual Behaviour
Reproduction steps
local Countries = require('countries')
local str = Countries.CountryName('dummy')
str = nil
Return value of .CountryName
is automatically inferred to by the Intellisense to:
""|"Afghanistan"|"Africa"|"Albania"|"Algeria"|"American Samoa"|"Andorra"|"Angola"|"Anguilla"|"Antarctica"|"Antigua and Barbuda"|"Argentina"|"Armenia"|"Aruba"|"Ascension Island"|"Asia"|"Asia-Pacific"|"Australia"|"Austria"|"Azerbaijan"|"Bahamas"|"Bahrain"|"Bangladesh"|"Barbados"|"Belarus"|"Belgium"|"Belize"|"Benelux"|"Benin"|"Bermuda"|"Bhutan"|"Bolivia"|"Bonaire, Sint Eustatius and Saba"|"Bosnia and Herzegovina"|"Botswana"|"Bouvet Island"|"Brazil"|"British Indian Ocean Territory"|"Brunei"|"Bulgaria"|"Burkina Faso"|"Burundi"|"CIS"|"Cabo Verde"|"Cambodia"|"Cameroon"|"Canada"|"Cayman Islands"|"Central African Republic"|"Central America"|"Central Asia"|"Chad"|"Chile"|"China"|"Christmas Island"|"Cocos (Keeling) Islands"|"Colombia"|"Comoros"|"Congo"|"Cook Islands"|"Costa Rica"|"Croatia"|"Cuba"|"Curaçao"|"Cyprus"|"Czechia"|"Côte d'Ivoire"|"Democratic Republic of the Congo"|"Denmark"|"Djibouti"|"Dominica"|"Dominican Republic"|"East Asia"|"Ecuador"|"Egypt"|"El Salvador"|"England"|"English Speaking"|"Equatorial Guinea"|"Eritrea"|"Estonia"|"Eswatini"|"Ethiopia"|"Europe"|"Falkland Islands"|"Faroe Islands"|"Federated States of Micronesia"|"Fiji"|"Finland"|"France"|"French Guiana"|"French Polynesia"|etc...
Additional Notes
No response
Log File
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working