Vim9Script Types Help
I’m trying to add types to a language list in my vimrc
file, the variable looks like this:
var languages = {
'c': ['c', 'h'],
'shell': ['sh'],
'python': ['py'],
'json': ['json'],
'typescript': ['tsx', 'jsx', 'js', 'ts'],
}
I’ve tried adding types like this:
var languages: dict<string, list<string>> {...}
Which should work I think but I’m getting this error:
E488: Trailing characters: , list<string>> = {
I can’t figure out which characters are trailing and AI has no idea either.
Solution
I was being a moron and defining a type for the key in the dictionary which makes no sense because the key name would always be a string so therefore only the value type is required:
var languages: dict<list<string>> {...}
You must log in or # to comment.