I was able to get this to work by creating a @types/window.ai package.
In this implementation,
in the web app, typescript is able to find the types for window.ai after installing @types/window.ai with no other changes required.
I also tried to get this to work by just creating a package windowai and including the types in the package.json as
types: 'index.d.ts'
But in this case, I wasn't able to get typescript to find the types without requiring the user to modify their tsconfig.json
I think there should be a way to publish a npm package, that includes types that are found by ts without requiring any other changes, but i'm not sure how to do this yet.
I was able to get this to work by creating a @types/window.ai package.
In this implementation,
in the
web
app, typescript is able to find the types for window.ai after installing @types/window.ai with no other changes required.I also tried to get this to work by just creating a package
windowai
and including the types in the package.json astypes: 'index.d.ts'
But in this case, I wasn't able to get typescript to find the types without requiring the user to modify their tsconfig.json
I think there should be a way to publish a npm package, that includes types that are found by ts without requiring any other changes, but i'm not sure how to do this yet.