Skip to content

Using d.ts files for autocompletion on non typescript files #220

@Grimi94

Description

@Grimi94

Hello! I have use the library to work on typescript files and everything works great but recently I had to go back to a few files that are written on JS and I have been trying to get autocompletion to work.

For now I was able to get it working with a solution based on this link:
https://blog.8bitzen.com/blog/23-09-2022-using-jsconfig.json

It consists of adding JSDocs pointing to the d.ts files like so:

/**
 * @NApiVersion 2.1
 * @NScriptType Restlet
 * @NModuleScope SameAccount
 */
define(['N/log', 'N/search'],
/**
 * @param {import('../../../node_modules/@hitc/netsuite-types/N/log')} log
 * @param {import('../../../node_modules/@hitc/netsuite-types/N/search')} search 
 */
       function (log, search) {

Which seems a little bit hacky but allows autocompletion to work

Screen Shot 2022-09-15 at 5 47 37 PM

Is there another approach to make this work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions