SQL Config Syntax Error - What am I missing?

Just trying to configure SQL with the PostgreSQL dialect and hopefully getting autocomplete. I am getting a syntaxError: expected expression, got ‘:’. Obviously I am misreading the docs. Can someone explain what I am missing? Thanks.

import {basicSetup, EditorView} from "codemirror"
import {SQL, PostgreSQL} from "@codemirror/lang-sql"

let view = new EditorView({
  doc: "// Type something here \n",
  extensions: [
    basicSetup, SQL(config?: SQLConfig = {dialect?: PostgreSQL}
                   )
  ],
  parent: document.body
})

This really looks like you are going to need to learn some more basic JavaScript before you jump into this. But concretely, you have these issues:

  • The sql export isn’t capitalized, so you need to import sql not SQL.
  • To use it, do sql({dialect: PostgreSQL}). I guess you pasted the parameter name and type from the docs, but that is not how JavaScript function calls work.

Thank you for the gentle response.