const Typesense = require('typesense')
let client = new Typesense.Client({
'nearestNode': { 'host': 'xxx.a1.typesense.net', 'port': '443', 'protocol': 'https' }, // This is the special Nearest Node hostname that you'll see in the Typesense Cloud dashboard if you turn on Search Delivery Network
'nodes': [
{ 'host': 'xxx-1.a1.typesense.net', 'port': '443', 'protocol': 'https' },
{ 'host': 'xxx-2.a1.typesense.net', 'port': '443', 'protocol': 'https' },
{ 'host': 'xxx-3.a1.typesense.net', 'port': '443', 'protocol': 'https' },
],
'apiKey': '<API_KEY>',
'connectionTimeoutSeconds': 2
})
If you're using typescript, it will throw an error saying that the type of port is wrong for the nodes and should be a number. Looking at the javascript directly seems to not be affected by this as it's being used in a .concat operation so it'll cast it to string no matter what, but still, either the example is wrong or the type is wrong. I think it's the former.
Description
The javascript configuration is wrong in the example on this page:
If you're using typescript, it will throw an error saying that the type of
port
is wrong for the nodes and should be a number. Looking at the javascript directly seems to not be affected by this as it's being used in a.concat
operation so it'll cast it to string no matter what, but still, either the example is wrong or the type is wrong. I think it's the former.