Comments (12)
I don't want to be replicating every possible way to determine whether there's types when there's an existing index of all this info, the npm-search index is wrong for this dep: https://yarnpkg.com/?q=type-fest the answer is in fixing that - maybe algolia/npm-search#407 fixes it
from type-fest.
Nice! Yes, would be nice to come up with a playground that shows off many of the utilities.
from type-fest.
I'll try and have a look into this, dude. ❤️
from type-fest.
@orta There's one thing I don't understand.
Is your README example meant to work?
There were no types for 'type-fest' - will not try again in this session
from type-fest.
Interesting, the algolia index thinks there's no types in the package:
curl 'https://ofcncog2cu-dsn.algolia.net/1/indexes/npm-search/type-fest?attributes=types&x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%20(lite)%203.27.1&x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e' \
-XGET \
-H 'Accept: */*' \
-H 'Origin: https://www.typescriptlang.org' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: ofcncog2cu-dsn.algolia.net' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' \
-H 'Accept-Language: en-us' \
-H 'Referer: https://www.typescriptlang.org/' \
-H 'Connection: keep-alive'
So the playground doesn't grab them at runtime - the problem is here somehow: https://github.com/algolia/npm-search
from type-fest.
I'm no expert at whatever you're using, but couldn't you fetch the package.json
of the package via unpkg and check the types
property? And, if it exists, fetch the file referenced in types
?
from type-fest.
Sitting at the computer thinking of how we could implement this. Seeing as TypeScript playground links are pretty long, would it be a good idea to setup a website (https://sindresorhus.github.io/type-fest/
) that redirects a URL such as https://sindresorhus.github.io/type-fest/play/except
to the appropriate TypeScript playground URL?
This might be easier to change, too. For example, we could just change the link in the redirection HTML to that of the new TypeScript playground link, should we choose to modify it.
Of course, the HTML for https://sindresorhus.github.io/type-fest/play/except
would look like this.
<meta http-equiv="refresh" content="2; url=https://www.typescriptlang.org/play/..." />
Am I overthinking this, or this is genuinely a good idea?
EDIT: After some thinking, this seems like breaking an egg with a sledgehammer, so to speak.
Expect a PR with TypeScript playground links.
from type-fest.
Why not take the opposite approach, the playground already supports examples. Add support for remote examples from other github repos:
So, it could be instead of:
https://www.typescriptlang.org/v2/en/play/?target=1#example/hello-world
it could be:
https://www.typescriptlang.org/v2/en/play/#example/sindresorhus/type-fest/hello-world.ts
from type-fest.
Interesting, the algolia index thinks there's no types in the package:
Would a quick fix be to add a types
field to this projects package.json?
from type-fest.
Sure, that might do it 👍
from type-fest.
Great. Let's do it now.
from type-fest.
The index seems to mark typescript as included now, but still is missing on the typescript playground, any idea what could be going on?
curl 'https://ofcncog2cu-dsn.algolia.net/1/indexes/npm-search/type-fest?attributes=types&x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%20(lite)%203.27.1&x-algolia-application-id=OFCNCOG2CU&x-algolia-api-key=f54e21fa3a2a0160595bb058179bfb1e' \
-XGET \
-H 'Accept: */*' \
-H 'Origin: https://www.typescriptlang.org' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: ofcncog2cu-dsn.algolia.net' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15' \
-H 'Accept-Language: en-us' \
-H 'Referer: https://www.typescriptlang.org/' \
-H 'Connection: keep-alive'
{"types":{"ts":"included"},"objectID":"type-fest"}
from type-fest.
Related Issues (20)
- IfAny circular constraint in TS 5.4+ HOT 2
- Make the second argument to RequireAllOrNone optional HOT 1
- Use `NoInfer`?
- Type for serializable objects? HOT 3
- Proposal: SetKeyRequired with key required, but allow undefined value HOT 2
- OverrideProperties changes undefined as optional HOT 2
- Exclude / Pick type in Paths / only add leaf nodes HOT 2
- `Proposal`: add option with exclude/keep specified type on deep type HOT 5
- Unify `Get` and `Paths` / `PickDeep` etc HOT 1
- `Paths` is unable to escape dots in property names
- DistributedOmit may not need to constraint the second type argument HOT 6
- A type util to produce an alternation of function overloads. HOT 1
- PositiveIntegerString type HOT 4
- Type-fest based prelude HOT 1
- ArrayExceptLastElement type HOT 7
- Zero is not exported by ... HOT 1
- `And` and `Or` is not exported at `index.d.ts`
- ConditionalKeys does not correctly filter out `never` type HOT 2
- Paths<T> should handle recursive types
- `PickDeep` strips `null` HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from type-fest.