Coder Social home page Coder Social logo

cocoascript-types's People

Contributors

arvinxx avatar dependabot[bot] avatar semantic-release-bot avatar yesmeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cocoascript-types's Issues

所有 set 类方法丢失入参类型

image

错误如上

image

以及每个对象应该是支持采用 get 和 set 的取值和赋值方法的。

即:

取值时可以使用

t = xxx.title()

或者

t = xxx.title

赋值时使用

xxx.setTitle('Title') 

也应该支持下述的写法

xxx.title = "Title"

但是这样是不是目前 Typescript 不支持同时具有 get、set方法和同名的函数方法?

not generated

  • NSMakeRect
  • NSColor
  • NSWindowMiniaturizeButton
  • NSWindowZoomButton
  • NSBoxSeparator
  • NSUTF8StringEncoding
  • NSCachesDirectory
  • NSUserDomainMask
  • NSSelectorFromString
  • NSHomeDirectory
  • NSOKButton

wrong types

  • NSButton.alloc().initWithFrame
  • NSTask.alloc().init
  • NSUserDefaults.alloc().initWithSuiteName(NS).objectForKey
  • NSString.alloc().initWithData_encoding
  • NSTemporaryDirectory
  • persistentDomainForName

NSPasteboardType 类型的全局声明问题

拿这个方法测试了下 (来源):

/**
 * 获取粘贴文本
 **/
export const getTextFromClipboard = (): string => {
  const pasteboard = NSPasteboard.generalPasteboard();
  return pasteboard.stringForType(NSPasteboardTypeString).toString();
};

目前类型提示会报错。

image

NSPasteboardstringForType 传入的是 NSPasteboardType 类型。

虽然在文档里面 NSPasteboardType 的类型是 NSString,但是其实它是有合法值的,例如 NSPasteboardTypeURLNSPasteboardTypeStringNSPasteboardTypePNG 等。而这些合法值应该都是在 Cocoa 环境中直接全局定义过了的。

因此需要在全局声明 NSPasteboardTypeString 等变量才行。

image

这样就不会报错了
image

以及以此类推的话,是不是所有 Type Alias 相关的合法变量都要在全局声明一遍?

优化注释需求

image

如上图,所有注释中 doc: xxxxxx 的部分能否改成 @see https://developer.apple.com/xxxx
这样的话当跳转进类型定义文件之后,可以直接点击相应的链接转到文档网站,像下图这样:

image

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.