Coder Social home page Coder Social logo

Comments (13)

kanarupan-addsearch avatar kanarupan-addsearch commented on July 18, 2024 1

@abhinayts

(1) We have successfully tried the below settings
Typescript support feature branch: https://github.com/AddSearch/js-client-library/tree/provide-type-support-for-library
Windows Platform: amazon/Windows_Server-2022-English-Full-Base-2023.05.10
nvm: 1.1.11
node: 10.17.6
npm: 6.14.15
typescript: 5.0.4
react + typescript sample public project: https://github.com/Lemoncode/react-typescript-samples/tree/master/hooks/01_HelloReact

(2) High-level steps

a) js-client-library:

  1. in the Windows platform perform the suggested modification in package.json
    #12 (comment)

  2. run npm install

  3. run npm run build

b) the sample project 01_HelloReact:

  1. replace hello.tsc with the below content
import * as React from "react";
import AddSearchClient from 'addsearch-js-client';

export const HelloComponent = () => {

  let client: any = new AddSearchClient( `<adddsearch customer public key>`);

  client.search('keyword', (response: any) => {
    console.log(response);
  });

  return <h2>Hello component !</h2>;
};

  1. run npm install
  2. run npm install <local directory path to the root of js-client-library>
  3. npm run start
  4. check localhost:8080 with the network tab for the request with the <adddsearch customer public key>.

(3) If the above isn't helpful to resolve your particular issue, then,

  1. kindly list the relevant technology versions as in section (1) above. Provide other information that you deem useful to replicate your specific environment.
  2. or to speed up the process it's better to contact our support [1] and pass this Issue thread [2], so we could work out 1. interactively.

[1] https://www.addsearch.com/support/contact-support/
{2] #12

from js-client-library.

shinriyo avatar shinriyo commented on July 18, 2024

I just pull-requested for only class.
DefinitelyTyped/DefinitelyTyped#46203

I hope someone adds for it.

from js-client-library.

shinriyo avatar shinriyo commented on July 18, 2024

@anttiai
I guess it is helpful.

https://medium.com/airbnb-engineering/ts-migrate-a-tool-for-migrating-to-typescript-at-scale-cd23bfeb5cc

from js-client-library.

nexiuhm avatar nexiuhm commented on July 18, 2024

Any updates on Typescript support ? Thanks : )

from js-client-library.

abhinayts avatar abhinayts commented on July 18, 2024

Is there a package which can be used in Typescript project? Badly in need of it.

from js-client-library.

jkytomaki avatar jkytomaki commented on July 18, 2024

@abhinayts we have worked towards bringing Typescript support to the project. Could you take a look at the branch provide-type-support-for-library and see if this works for you?

from js-client-library.

abhinayts avatar abhinayts commented on July 18, 2024

@jkytomaki I tried to install 0.8.2 but I don't see types installed in module. I am using npm install --save-dev [email protected]. Am I missing anything? Also repo is not building getting error while running npm run build.

[email protected] build **\Repos\js-client-library-provide-type-support-for-library\js-client-library-provide-type-support-for-library
npm run test && ./node_modules/webpack-cli/bin/cli.js

[email protected] test **\Repos\js-client-library-provide-type-support-for-library\js-client-library-provide-type-support-for-library
./node_modules/mocha/bin/mocha.js --recursive --require @babel/register -r esm

'.' is not recognized as an internal or external command,

from js-client-library.

haoAddsearch avatar haoAddsearch commented on July 18, 2024

@abhinayts the feature branch is not published to npmjs, so to use it you need to clone the repo to your machine then install it from there.
npm install /path/to/project/folder/js-client-library

Regarding error with npm run build, you could try removing ./ at the beginning of "test" and "build" script in package.json.

from js-client-library.

abhinayts avatar abhinayts commented on July 18, 2024

removing ./ not helping.

from js-client-library.

haoAddsearch avatar haoAddsearch commented on July 18, 2024

In case you are using Windows machine, try editing package.json's scripts with this

"test": "node node_modules/mocha/bin/mocha.js --recursive --require @babel/register -r esm"

"build": "npm run test && node node_modules/webpack-cli/bin/cli.js"

from js-client-library.

abhinayts avatar abhinayts commented on July 18, 2024

@haoAddsearch so after using it the code in my application I am getting error. My application is TS application.
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'prototype')

.next\static\chunks\webpack.js (25:0) @ webpack_require

23 | webpack_require.i.forEach(function(handler) { handler(execOptions); });
24 | module = execOptions.module;

25 | execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
26 | threw = false;
27 | } finally {
28 | if(threw) delete webpack_module_cache[moduleId];

from js-client-library.

haoAddsearch avatar haoAddsearch commented on July 18, 2024

@abhinayts we will need to create a bug ticket and look into this. Could you tell which frontend/backend framework your application is using?

from js-client-library.

abhinayts avatar abhinayts commented on July 18, 2024

@haoAddsearch I am trying to use it in react application using typescript.

from js-client-library.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.